Forum Moderators: phranque
RewriteEngine On
RewriteCond %{http_host} ^(.*)\.subdomain\.olddomain\.com$
RewriteRule ^(.*)$ http://www.newdomain.com/$1 [R=301,L]
I've looked high and low for this, and tried different variations, with no success. Can someone help?
Thanks!
[edited by: jdMorgan at 9:04 pm (utc) on Oct. 11, 2006]
[edit reason] de-linked [/edit]
Is that what you want?
If not, then what do you mean, very specifically, by "it doesn't work"? How did you test, what were the results, and how did those results differ from your expectations?
Jim
No longer exists, and I want people who visit it to go to:
[newdomain.com...]
Hope this helps?
Here's an example:
You have a domain:
example.com
You had a forum on it, at:
forum.example.com
But now, you have a new domain:
example-forum.com
So you want to redirect:
forum.example.com to example-forum.com
Does that makes sense?
Edited to add: You still own and run example.com.
[edited by: jdMorgan at 10:20 pm (utc) on Oct. 11, 2006]
[edit reason] Example.com [/edit]
RewriteEngine on
RewriteCond %{HTTP_HOST} subdomain\.olddomain\.com
RewriteRule (.*) http://www.newdomain.com/$1 [R=301,L]
Removing the start- and end- anchoring from the hostname pattern allows it to match <anything_or_nothing>subdomain.olddomain.com<any port number>
Do not feel free to substitute lowercase for uppercase or vice-versa in config code. In many cases it will work, but in many others it won't. Use the case as shown in the Apache directives' documentation for best results and portability across operating systems and Apache versions.
Jim