-5

i want to redirect my http://subdomain.domain.com to http://subdomain.domain.com/user/index.php?name=subdomain is this possible via htaccess

1 Answers1

0

Yeah, its possible.

Add the following to your htaccess

RewriteEngine on



RewriteCond %{HTTP_HOST} ^((?!www\.).+)\.example.com
RewriteRule !index\.php http://%{HTTP_HOST}/user/index.php?name=%1 [L,R,NE]

The rule above will redirect foo.example.com to foo.example.com/user/index.php?name=foo

Amit Verma
  • 40,709
  • 21
  • 93
  • 115