Click to See Complete Forum and Search --> : "permanently moved" 301 a folder with .htaccess?


michaellunsford
10-04-2008, 04:04 PM
I have some depreciated content on my site, so I want to move it to a folder called "depreciated." All of this content is contained in unique folders in site root. Moving the files is pretty easy, I just drag them into the "depreciated" folder and I'm done.

Now the problem is some people will want to have access to this data for the foreseeable future with existing links. I can't just cut them off, and a blast email or announcement on the homepage isn't my idea of fun either. Also adding to complexity is these sub-directories are not named with any particular rhyme or reason.

So, I'm thinking .htaccess can help. This code is supposed to redirect everything to a subfolder within the site.
RewriteRule ^(.*)$ /somefolder/$1 [R=301,L]
Easy, but I don't want everything moved. I'd prefer to wrap this in ErrorDocument some kind of way. Any idea how to accomplish this? is .htaccess the answer?

chazzy
10-04-2008, 05:50 PM
htaccess is likely the answer. It uses regular expressions (the text ^(.*)$ in this case) in order to determine what to apply rules to. if you wanted to notify someone that bob moved, you could add the rule


RewriteRule ^bob$ /somefolder/$1 [R=301,L]


And it should move your request to bob.

michaellunsford
10-05-2008, 10:44 AM
That's correct. The challenge is I want it to move missing pages rather than me typing in some 100 directories, thereby adding 100 lines to the .htaccess file.