Forum Moderators: phranque
My question is, will this code take care of the split linking problem or do I still need to have all the links pointing to either the directory or the file? Is it true that it does not matter with this code?
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]*/)*index\.(html?Šphp)\ HTTP/
RewriteRule ^(([^/]*/)*)index\.(html?Šphp)$ [www\.example\.com...] [R=301,L]
I have asked other questions about this code before. I do not know why I am so confussed by it, but I am learning.
Is there a down site to this code that I am not seeing. I am always paranoid when adding a sweeping code like this that affects so much of my site when I am not sure of the full ramifications of it. I would really appreciate some further guidance so that I do not create a bigger mess with my linking than I already have.
Over time, you should work to replace the "incorrect" links on your pages with the correct links. This is so that the search engines won't have to follow the redirect in the code every time they follow an incorrect link, causing them to think your site is badly designed or maintained -- an indicator of poor quality.
Another reason is that a redirect ends the current HTTP request and requires the client to start a new one, re-requesting the desired resource from the new URL provided by the server's initial 301 response. This doubles the number of requests to your server for that one resource, slows down the visitor experience, and pollutes your log files with 301 response records, also skewing your 'stats' reports and making them less useful.
Jim
I will start fixing the links, but I wanted to check this one more time:
Does it matter if I direct my links to example.com/directory/ or example.com/directory/index.html as far as SEO and web standards? It is easier for me to link everything to the index file instead of the directory (and more consistent for me to keep up with) so if it does not really matter than that is what I am going to do. I have probably made things even more of a mess by introducing the code above into the mix.
You should redirect all index page requests to "/", and link only to "/" on your pages.
See this recent thread [webmasterworld.com] for the code.
Jim