i want to redirect my http://subdomain.domain.com to http://subdomain.domain.com/user/index.php?name=subdomain is this possible via htaccess
Asked
Active
Viewed 43 times
-5
-
Yes. It is possible via htaccess. – hjpotter92 Aug 12 '16 at 13:48
-
2Possible duplicate of [Redirect all to index.php htaccess](http://stackoverflow.com/questions/18406156/redirect-all-to-index-php-htaccess) – rafalmp Aug 12 '16 at 14:48
1 Answers
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