Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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?

share|improve this question

migrated from stackoverflow.com May 3 '11 at 9:16

This question came from our site for professional and enthusiast programmers.

Instead of using a rewrite rule, wouldn't the DirectoryIndex setting in Apache achieve the same thing? – DaveRead Apr 29 '11 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 '11 at 17:19

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.

share|improve this answer

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.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.