Forum Moderators: phranque

Message Too Old, No Replies

Question about 301 Redirect

From Subdirectory to a Different Domain

         

ginger231

1:52 pm on Jul 22, 2007 (gmt 0)

10+ Year Member



Hi,

Somehow, even though I had the noindex, nofollow meta tag in my staging directory for a site that I was creating, it still got indexed by MSN (maybe others). I'd like to do a 301 redirect in my .htaccess file redirecting any requests for any files or subdirectories in this folder to the site's own domain. This is what I've tried, but it didn't work:

Redirect 301 /staging/ http://www.sitesowndomain.com

Can someone help me get this right?

Thanks!
ginger

[edited by: jdMorgan at 2:16 pm (utc) on July 22, 2007]
[edit reason] De-linked [/edit]

jdMorgan

2:22 pm on Jul 22, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



> ... I've tried, but it didn't work

That doesn't tell us much... *How* did it not work?

How did you test?
What were the results?
How did those results differ from your expectations/requirements?

Without knowing that, all I can do is guess that you got an error message or that you want all pages redirected to the root of the new domain, dropping the paths to the individual pages themselves. In that case, I'd suggest:


RedirectMatch 301 ^/staging/(.*)$ http://www.sitesowndomain.com/

Jim

ginger231

2:57 pm on Jul 22, 2007 (gmt 0)

10+ Year Member



Sorry that wasn't clear. It wasn't redirecting subdirectories. Your example works perfectly.

Thank you!

ginger