Use htaccess to redirect all traffic from subdomain to domain without maintaining directory structur
Posted
by hal10001
on Stack Overflow
See other posts from Stack Overflow
or by hal10001
Published on 2010-04-08T03:54:58Z
Indexed on
2010/04/08
4:13 UTC
Read the original article
Hit count: 419
Most examples show how to redirect all subdomain traffic to a primary domain, maintaining the directory structure. I actually don't want this. I want to redirect all subdomain traffic (the site is going away) to the primary domain. This is not working:
Options +FollowSymLinks
RewriteEngine on
RewriteRule (.*) http://www.newdomain.com/ [R=301,L]
What happens, is if you go to this:
http://sub.newdomain.com/some/path/
You get this:
http://www.newdomain.com/some/path/
I want it all to go to the root.
© Stack Overflow or respective owner