Reversing a mod_rewrite rule
- by KIRA
I want to redirect accesses from
http://www.domain.com/test.php?sub=subdomain&type=cars
to
http://subdomain.domain.com/cars
I already have mod_rewrite rules to do the opposite:
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{HTTP_HOST} !^(www)\. [NC]
RewriteCond %{HTTP_HOST} ^(.*)\.(.*)\.com [NC]
RewriteRule (.*) http://www.%2.com/index.php?route=$1&name=%1 [R=301,L]
What changes do I need to make to these rules to redirect requests from the script to the subdomain?