views:

117

answers:

4

Ok, I know it is best practice that once you change or remove a page URL, to redirect that url to the new relevant URL.

But for how long? forever?

For example, I am using Google website optimizer to test different variations of a page. So I have to create a different url for each like: original.php, var1.php, var2.php, etc.

once the test is done, the winner will become the new original.php and there will be no need to keep var1.php, etc. But I now need to redirect those no longer needed URL's to the relevant original.php.

This can end up being a ALOT of 301 redirects in my .htaccess file. I also have heard that the more stuff you have in your .htaccess file the slower your site becomes because the server has to process everything in it before it can serve a page.

I can move the redirects to the actual URLs (example a php redirect on the actual var1.php file) but then I have several unneeded files bloating up my server.

So I am wondering whats the best practice here? is it safe to remove a 301 redirect after so long?

+10  A: 

You can check your web server's access logs for the 301 redirects on those URLs. When they no longer appear in the logs (or appear very rarely), you can remove the redirects if you feel like it. There is no particularly best time to remove them. The "best" time is when the old URLs are no longer used, and that can differ a lot from site to site.

Daniel Egeberg
Agreed. You should also watch the log for 404's in general to make sure there aren't any old URL's that you might have missed.
CaseySoftware
Also use google's 'pages that link to' advance search feature
+1  A: 

When you are testing variations, that is a private URL. As long as there are no external links to it and you don't publicize it, you can destroy it when your tests are done.

If you share it only with others in your organization, under the agreement that it is ephemeral, that is a gray area. Daniel Egeberg's suggestion of maintaining forwarding for a time is civilized.

Once you make the URL public, you must treat it as archival. That means you make sure it works forever. There are a couple of exceptions I might condone:

  • Someone has exercised force majeure and has shut down the entire domain, like Geocities. Don't let this happen to you: don't put your valuable web pages under the control of for-profit entities.

  • Someone has bought your domain out from under you with an offer you couldn't refuse.

  • You've gone bankrupt or can no longer afford to maintain a presence online.

In these cases, your moral obligation is to make your content available through archive.org or through Jason Scott, who has plenty of good advice.

If you control your own domain and you let a public URL go stale, you will burn in hell. (Little-known post-Dante theology.)

Norman Ramsey
A: 

Perhaps there is a better way to manage your .htaccess file. Are your redirects for single pages, paths, subdomains, or domains?

It may be possible to include an external file, so that your redirects are in their own file and the .htaccess inlcudes that and stays uncluttered.

Finally, there may be a better way to maintain your redirects. So rather than focusing on how long to maintain your redirects, save some maintenance work and change your question to ask about mechanisms that make it easier to add and organize your redirects. IIRC mod_rewrite will do this. There has to be a mechanism that will let your server determine redirects by using a script (perhaps query a DB). At minimum, it would be smart to use a script to manage your .htaccess files redirects.

An advantage to never having redirects expire is that you also never have to go back in and clean out the old redirects. They just sit there, forever. If you have redirects that expire, you now have a second operation to perform to remove the old redirects. So you're actually doing more work by expiring redirects.

Freiheit
A: 

Norman, surely if a page is generated by php, then it can not be considered 'archival'. php almost guarantees that the page will look different next time. If by different you choose 'not there' then that is up to you!

I would also suggest that you may be able to deprecate these pages if people are using them, by not forwarding, but putting a link there telling the user that the page has moved, and asking them not to use the old one. Put a link for them to click. Do that for 'a while'. i guess the period on that depends on your expected user behaviour. Do you expect every user to have visited once a month, or is it like a tax return system which people use once a year?

Jon