I am trying to create a multilanguage website. And I have set my home page to a static page in my WP admin area.

This home page ID is 2 and it calls front-page.php template when I am on the home page at this address, for example, http://examplesite.com/

So for a french version, I have added a new rewrite rule so I have this url, http://examplesite.com/fr/, and its call the same home page which is ID 2.


But why it calls index.php template instead but not front-page.php?

How can I make http://examplesite.com/fr/ to call front-page.php?

  • Because that's how WordPress handles requests made to your WordPress site. The index.php file would eventually load your front-page.php file, if the request was your site's home/front page - or the static Page in your case.
    – Sally CJ
    Aug 15, 2018 at 4:20
  • @SallyCJ it does not load front-page.php just as I explained above already.
    – Run
    Aug 15, 2018 at 4:28
  • 1
    If that rewrite rule works on its own, you've got something non-standard happening, as a default WordPress install would redirect that request to the root URL. If you disabled canonical redirect to prevent that, it would show the front-page.php template. You've got a theme or plugin that is somehow changing some fundamental parts of the query/template process, first step is to figure out if it's your theme or what plugin is doing this.
    – Milo
    Aug 15, 2018 at 4:28
  • 1
    Yes I understand about that @laukok. I was referring to the "why index.php" as in the rewrite rule there. Try changing the ?&p=2 to ?page_id=2?
    – Sally CJ
    Aug 15, 2018 at 4:34
  • 1
    @laukok Check my answer.
    – Sally CJ
    Aug 15, 2018 at 4:56

1 Answer 1


As I pointed in my comment, in the rewrite rule there, change ?&p=2 to ?page_id=2. Because p is used for querying a Post (i.e. post of the post type). So for Pages (i.e. post of the page type), use page_id.

To prevent http://examplesite.com/fr/ from being redirected to http://examplesite.com/, you can cancel (the) canonical redirect, like this:

add_action( 'template_redirect', function(){
    if ( is_front_page() ) {
        remove_action( 'template_redirect', 'redirect_canonical' );
}, 0 );
  • 1
    You're very welcome. :)
    – Sally CJ
    Aug 15, 2018 at 5:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.