Forum Moderators: phranque

Message Too Old, No Replies

RewriteCond Code and Split Links

         

riospace

1:26 pm on Nov 16, 2006 (gmt 0)

10+ Year Member



I have problem with split links throughout my site (example - some links are pointing to example.com/directory/ and some are pointing to example.com/directory/index.html). I added the following code in hopes that it would alleviate this linking problem that could lead to Google thinking I have duplicate content. I have thousands of pages with this link inconsistency and it would take me forever to sort through this mess.

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.

jdMorgan

2:55 pm on Nov 16, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You will have a smaller mess with the code.

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

riospace

4:00 pm on Nov 16, 2006 (gmt 0)

10+ Year Member



Thanks for your help 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.

riospace

9:11 pm on Nov 16, 2006 (gmt 0)

10+ Year Member



One other question, if I change all of my example.com/directory/ links to example.com/directory/index.html, do I need to do a redirect for this? If so, what kind of redirect do you recommend?

jdMorgan

12:21 am on Nov 17, 2006 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> web standards

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