Reputation: 3779
I have the following code and the only redirect that seems to be working is the first one. I get 500 errors on the other redirects. Any insight is greatly appreciated.
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^test1.domain.com
RewriteRule (.*) http://s.domain.com/sub1/$1 [L]
RewriteCond %{HTTP_HOST} ^test2.domain.com
RewriteRule (.*) http://s.domain.com/sub2/$1 [L]
RewriteCond %{HTTP_HOST} ^test3.domain.com
RewriteRule (.*) http://s.domain.com/sub3/$1 [L]
</IfModule>
Upvotes: 2
Views: 667
Reputation: 12727
Try this:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^test(1|2|3)\.domain\.com$ [NC]
RewriteRule ^(.*)$ http://s.domain.com/sub%1/$1 [L,R]
</IfModule>
Upvotes: 3