Archive for January 22nd, 2010
-
Apache Rewrite rule for subdomains
Friday, January 22nd, 2010
Requirements abc-subdomain.domain.com/urlpath/urlpath -> subdomain.domain.co.in/urlpath/urlpath (‘subdomain’ is a wildcard and could be anything, ie abc-fashion.domain.com, abc-entertainment.domain.com, etc.). in.domain.com/urlpath/urlpath -> domain.co.in/urlpath/urlpath Rewrite Rule RewriteEngine On RewriteCond %{HTTP_HOST} ^abc-(.*).domain.com (abc- is fixed .* means anything before .domain.com) RewriteRule (.*) http://%1.domain.co.in$1 [R] (%1 changed according to .domain.com) RewriteCond %{HTTP_HOST} ^in.domain.com (anything starting with in.domain.com redirected to http://domain.co.in ) RewriteRule [...]




