Thoughts on 301 Redirects

I’ve done a lot of searching around forums, google, etc. trying to decide the best ways to utilize 301 redirects the “right” way and I’ve got a few different methods for different purposes, but I came across a question that perplexed me a bit.

What I want to do is redirect an entire subdirectory, which has about 25 pages in it.

For hypothetical purposes we’ll say the website is [noparse]http://domain.com/[/noparse]

What I want to do is redirect the subdirectory: [noparse]http://domain.com/abc/[/noparse] and its contents:

[noparse]http://domain.com/abc/a.html[/noparse]
[noparse]http://domain.com/abc/b.html[/noparse]
[noparse]http://domain.com/abc/c.html[/noparse] etc. etc.

to a new subdirectory: [noparse]http://domain.com/def/[/noparse] that would have:

[noparse]http://domain.com/def/a.html[/noparse]
[noparse]http://domain.com/def/b.html[/noparse]
[noparse]http://domain.com/def/c.html[/noparse] etc. etc.

What I was thinking was to use a redirect in the .htaccess file

Redirect /abc /def

Do you think that would be the best way to redirect the entire directory to a new one or would there be a better way? or should I just:

<%@ Language=VBScript %>
<%
' Permanent redirection
Response.Status = "301 Moved Permanently"
Response.AddHeader "Location", "http://www.website.com/"
Response.End
%>

On all of the pages. This is one I use for single pages, because I know it poses no problems, but I’d hate to do it 25 times…

Or something else perhaps…

My main goal is to improve the permalink structure for SEO purposes, but I don’t want to hurt anything in the meantime by using the wrong kind of redirect.

Any input would be appreciated!

Please don’t use a real domain in your examples, and please remember to turn off automatic parsing of URLs if you want to include http:// or www.

My apologies, when I wrote it, I didn’t have the links. Will pay more attention in the future.

(Also with the real domains)

That’s OK. It’s not just aimed at you, it’s a wee reminder to anybody who might reply, too. :slight_smile:

I would go with


Redirect 301 /abc /def

(if you omit 301, Apache will use the default redirect status, which is 302 – temporary redirect, which is not what you want, see http://httpd.apache.org/docs/2.0/mod/mod_alias.html#redirect)

No need to start the VBEngine if you already know what you want in the .htaccess – just let Apache figure it out :slight_smile:

Thanks. Shouldn’t hurt anything as far as google rankings, seo or anything along those lines should it?

I’m not big on that subject, but from what I’ve heard it indeed shouldn’t; although I’ve also heart people say you may loose a little bit of link juice, but that the amount is negligible.
Again, I’m really not big on the subject, so I can’t be 100% sure here.

Okay, thanks. I haven’t had problems with redirects before, but I’ve never redirected an entire directory. Sales have been down on the particular site I’m doing it on-seasonal sales, so if I have problems there’s plenty of time to get it back up.

Thanks for the help. I appreciate it greatly!