tags:

views:

172

answers:

3

I'm about to work on a retail product website that has been around for about 10 years. The website ranks nicely in Google search results. The website has evolved a lot over the years so it's no surprise their .htaccess file is full of 301 redirects and rewriterules. There are so many rules it's an eye sore. Sometimes there are three different legacy urls that 301 redirect to the same destination. I'm concerned this file will be a nightmare to maintain down the road.

Does a web developer ever reach a point where he's willing to remove old redirect and rewrite rules for easier maintenance at the cost of SEO? Or does Google have a copy of the website's 301 redirects, in which case, I can remove them from my .htaccess file without any SEO penalty?

How does a developer deal with a messy/lengthy .htaccess file?

+2  A: 

You're stuck with them. Think about this. If another site has a link that goes here:

http://www.example.com/oldpage.html

And you have this 301ed to:

http://www.example.com/newpage.html

What would happen if you removed that 301 (and oldpage.html doesn't exist)? Most likely your site will return a 404 error which would result in google removing the link (and "link juice") to your site. Thus reducing the SEO.

As far as I know google doesn't "remember" old 301 redirects. Because what would happen if all of a sudden you recreated oldpage.html? If google remembered the 301, then oldpage.html would never get indexed.

Keltex
A: 

One option is to dump all the old redirect rules into an external file.

RewriteMap oldurls txt:S:\rewritemaps\oldurls.txt [NC]
RewriteRule ^(.*\.asp)$ ${oldurls:$0} [NC,L,R=301]

A second option is to consolidate the rules. The rules below...

RewriteRule ^/about/page1.asp /about [NC,L,R=301]
RewriteRule ^/about/page2.asp /about [NC,L,R=301]
RewriteRule ^/about/page3.asp /about [NC,L,R=301]

could be consolidated into:

RewriteRule ^/about/page(.*).asp /about [NC,L,R=301]

Eventually search engines will begin caching the destination Urls, so the original Urls will have less value. I think Google gradually transfers the Page Rank of the old Url to the new Url. To test if the redirect rules are being used, try adding querystrings the the ISPAI rules. You can track the queryStrings in Google Analytics.

RewriteRule ^/oldurl /newurl?redirect [NC,L,R=301]

It is likely people have old bookmarks, links from other sites, etc, so you may not want to remove the rules even if they are not being used. You can check to see who is linking to you in Google Webmaster tools.

James Lawruk
@James - "Eventually Google will begin caching the destination Urls, so the original Urls will have less value" This is not true. The original URLs have values because they are linked to from external sites. Also "You can track the queryStrings in Google Analytics" is bad advice as well. "People" aren't accessing the links necessarily, the search engines are doing so. Finally "You can check to see who is linking to you in Google Webmaster tools". Also not true. Google Webmaster tools doesn't show this information. You need a 3rd party tool like SEOMoz's Linkscape.
Keltex
@Keltex, "less value", not "no value." I mention later in the post you should not remove rules because of external links. The querystring idea is simply to test if the redirect rules are being used, and as you mention should not be proof to remove a redirect rule. To view who is linking to your site in Google Webmaster Tools, under the Dashboard on the left, select "Your Site on the Web", "Links to Your Site." Google admits not all links to your site may be listed in this report, but it is helpful.
James Lawruk
A: 

I would say take advantage of a URLRewriting framework or the functionality that is built into IIS 7.0. This should make it more maintainable and you will not have a link go dark.

Chris Marisic