Is there a best practice/convention to have www.example.com as opposed to www.example.com/index.php in a site's URL? I made the links to the homepage relative (i.e. href="index.php") as opposed to absolute, which causes "index.php" to appear in the URL.

Does this impact SEO, or is it considered sloppy? Should I write an apache rewrite rule to change requests to www.example.com/index.php to www.example.com?

  • 1
    Instead of using a rewrite rule, wouldn't the DirectoryIndex setting in Apache achieve the same thing?
    – DaveRead
    Apr 29, 2011 at 16:46
  • Looks like it might Dave. What are the benefits of using a DirectoryIndex as opposed to a rewrite rule?
    – Charles
    Apr 29, 2011 at 17:19

2 Answers 2


You generally want to avoid having the same page available via. multiple URLs (in your case presumably example.com/ and example.com/index.php), although this isn't an issue if you add a rel canonical tag. The simplest fix for you, if you want to keep using relative links would be to just use a href="./" when you want to link to the index.php page.


The place when it looks sloppy is when people quote your URL and put the index.php on the end. Tim's suggestion should help you with any SEO issues, so it's a good thing to do.

Your Answer

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