-
.htaccess rewriting
Hi, I haven't really used htaccess rewrite before but I've been told it can do what I want.
I'm currently using something which rewrites domain.com/xyz to domain.com/file.php?var=xyz
however, what I wish to do is redirect xyz.domain.com to this instead, how would I do this?
Thanks.
-
Code:
RewriteEngine on
RewriteCond %{REQUEST_URI} =/
RewriteRule .* http://example.com/ [R,L]
RewriteRule (.+) http://$1.example.com/ [R]
If you go to example.org it redirects you to example.com
If you go to example.org/hello it redirects you to hello.example.com
-
Hi, this is backwards to what I'd like to do;
I'd like to redirect xyz.example.com to example.com/page.php?var=xyz
If its just a simple rearrangement of that then I apologise, I don't know how to do it.
Thank you.