Htaccess: rewrite subdomain to script file

Rewrite all request from subdomain.domain.com like http://subdomain.domain.com/test.css to http://subdomain.domain.com/script.php

RewriteCond %{http_host} subdomain.domain.com [NC]
RewriteCond %{REQUEST_URI} !\.php$
RewriteCond %{REQUEST_URI} !\.css$
RewriteCond %{REQUEST_URI} !/css/(.*)$
RewriteCond %{REQUEST_URI} !/images/(.*)$
RewriteCond %{REQUEST_URI} !/scripts/(.*)$
RewriteCond %{QUERY_STRING} (.*)
RewriteRule ^(.*)$ /script.php [NC,L]

Leave a Reply