Page 1 of 1

mod_rewrite question

Posted: Fri Feb 24, 2006 1:51 pm
by evilmonkey
Hello,

I'm trying to set up mod rewrite so it will convert xxx.site.com to site.com/fwd.php?username=xxx. I got this in my htaccess:

Code: Select all

RewriteEngine on
RewriteRule ^([^/\.]+).site.com/? fwd.php?username=$1 [L]
But it doesn't seem to be working. Probably some dumb regex problem again. :( Any help is appreciated.

Thanks. :)

Posted: Mon Feb 27, 2006 8:44 pm
by evilmonkey
*bu-bu-bu-bump*

Posted: Mon Feb 27, 2006 10:05 pm
by Benjamin
Where is $1 coming from?

Posted: Mon Feb 27, 2006 10:33 pm
by redmonkey

Code: Select all

RewriteEngine on

RewriteCond   %{HTTP_HOST}        !^www\.
RewriteRule   ^(.+)               %{HTTP_HOST}          [C]
RewriteRule   ([^.]+)\.site\.com  /fwd.php?username=$1
Requires a wildcard ServerAlias definition in order to work.