Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

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.

1  
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

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.

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

 
discard

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