Log in

View Full Version : Rewrite for subdomain



martinf
03-05-2007, 09:59 PM
Having a bit of a hard time to come up with a way to do this.

The rewrite works, but instead of outputting http://www.domain.com/page.php?val=something I want it to display http://something.domain.com only. And, I also want it to only apply to page.php when val is set (if possible) and links on that page should be http://www.domain.com/tralala (if possible).

I'm right now using:


RewriteCond %{HTTP_HOST} !^www.* [NC]
RewriteCond %{HTTP_HOST} ^([^\.]+)\.domain\.com
RewriteRule ^(.*)$ http://www.domain.com/page.php?val=%1 [L]


Thankful for any help you can give me!

BLiZZaRD
03-07-2007, 07:38 AM
Have a look at B&T's Tips and Scripts (http://tips-scripts.com/?tip=pointing#tip)

Great resource site for a lot of little site tweaks too :D