RewriteRule - how to redirect from a folder within a folder to a new domain?

Posted by eb_Dev on Stack Overflow See other posts from Stack Overflow or by eb_Dev
Published on 2010-05-12T13:12:04Z Indexed on 2010/05/12 13:14 UTC
Read the original article Hit count: 135

Filed under:
|
|

Hi, I've been struggling with the following rule:

RewriteRule ^subdomains/example.com/(.*)$ http://www.example.com/$1 [R=301,L]

I'm trying to redirect anything that occurs after the folder /subdomains/example.com/ to http://www.example.com/ whilst including any filename or extra folder path information.

E.g:

www.olddomain.com/subdomains/example.com/index.html -> www.example.com/index.html www.olddomain.com/subdomains/example.com/files/ -> www.example.com/files/ www.olddomain.com/subdomains/example.com/files/index.html -> www.example.com/files/index.html

Any help would be greatly appreciated!

Thanks,

eb_dev

© Stack Overflow or respective owner

Related posts about rewriterule

Related posts about redirect