multiple rewrite for a single URL using htaccess

advertisements

I have a multi blog website in which there are multiple domains. The thing is i need a rewrite rule for the following syntax

XXX.domain.com/{any other things} to www.domain.com/domain/XXX/{any other things}

Also i had written a set of rules for the below one too

^domain/([a-zA-Z0-9]+)/cat/([a-zA-Z0-9]+)$ index.php?domain=$1&cat=$2

So the things is i need to construct a rule which converts domain to path then again process the other things as follows with that.


Before your other rule, you'll need

RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTP_HOST} ^([^.]+)\.
RewriteCond $1 !^domain/
RewriteRule ^(.*)$ /domain/%1/$1 [L]