2

Would home.PHP and main.HTML at the same website be confused by Google crawlers as canonical? If a website has home.php and also index.html do you think Google will down rank it in its search? What if index.html was replaced with main.html instead? Would that fix the situation?

Would Google penalize if a website has home.php (redirected from index.php and also index.html pages?

2
  • It is unclear what you are attempting to do. Why would you have these in the first place. Commented Apr 13, 2023 at 21:51
  • 1
    Ideally users would never see index.html or index.php included in any of your URLs. If you have those files, you should be linking to the directory URL rather than including the full file name in the URL. Commented Apr 14, 2023 at 1:00

1 Answer 1

1

Your server will be set up to serve default index page which may be default.html, index.html, index.php or something else. You can call your other pages what you like, though the extension may be important e.g. .php

On your server, you can set up a search order for the default index page. i.e. if it doesn't find the first one (default.html) it will look for the next (index.html) and so on down the list. You can also use .htaccess to serve a different file as your default page.

There is a problem only if the different pages are serving similar content, in which case you should use the canonical tag to point to the one you prefer.

What matters to the SEO is the URL used to access the pages, not what the files themselves are called or where they are located. You can use URL rewrites to control this.

There is a discussion Here for Apache

2
  • In my case /home.php is the actual home page by default of the store’s software code, which also has index.php pointing (redirecting) to /home.php and when I go to domain .com I simply arrive at domain .com without home.php in the URL. While a part of my site that is not mobile-friendly has its own “home page” which I renamed from index.html to main.html in hopes for better SEO. So now my site does not have any index.html at all and the index.php redirects to home.php as per above. People keep in telling me I MUST have index.html but I just deleted it and renamed the page with main.html.
    – John
    Commented Apr 14, 2023 at 20:44
  • The syntax used in .htaccess is ... DirectoryIndex first.html index.htm index.html index.php ... to avoid the index.php redirect use something like ... DirectoryIndex home.php index.htm index.html index.php ... then Apache will check for home.php first, (if it is not there is will check for index.htm next and so on in the order they are specified on the line) ... there are no penalties for having more than one file in a directory. Commented Sep 11, 2023 at 23:37

Your Answer

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

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