I've been told we need to change our domain names and I want to do so with the proper 301 redirects. The catch is we use a wildcard domain. How could I get mod-rewrite rules to have http://subdomain.aviation.siu.edu redirect to http://subdomain.aviation.siuc.edu? I've been playing with rewrite rules for some time, however this one completely escapes me.
pokinwilly
Member
Posted 16 years ago #
Hello cwiegman,
As this are 2 fully differents domains (siu.edu and siuc.edu), I would personaly do the following:
1. Associate your wordpress mu hosting with the new domain and update WP-mu configuration for each blog (this may be tricky).
2. Associate a very basic Apache hosting setup with the old domain name, and implement a very basic, generic, redirection in .htaccess. Something like:
RedirectPermanent http://aviation.siu.edu http://aviation.siuc.edu
(note that you may need to have one redirect line per subdomain, and maybe need to adapt the example; it's an idea, not a copy/past answer)
Good Luck.
Thanks pokinwilly, for many sites that will work, and in fact I've almost made that work except the subdomain is a wildcard. And all the sites need access both ways for now. I can't seem to find a way to set up a redirect that will allow me to use the wildcard subdomain. any suggestions?
I'm closer, however when viewing anything but the root I am redirected back to the root. any help with this?
RewriteCond %{HTTP_HOST} !^[^.]+\.aviation\.siuc\.edu$
RewriteCond %{HTTP_HOST} ^[^.]+\.aviation\.siu\.edu$
RewriteRule ^(.+) %{HTTP_HOST}$1 [C]
RewriteRule ^([^.]+)\.aviation\.siu\.edu http://$1.aviation.siuc.edu\$2 [R=301,L]
Try
RewriteCond %{HTTP_HOST} ^(.*)\.aviation\.siu\.edu$
RewriteRule ^(.*)$ http://%1.aviation.siuc.edu/$1 [R=301,L]
WPMUGURU You are my hero! Thank you!!!