Steering assistance subdomain, How should .htaccess

53 views Asked by At

Steering assistance subdomain

The original URL:

http://domain.com/index.php?cat=cats&id=12&url=stackoverflow

The rewritten URL:

http://cats.domain.com/12/stackoverflow.html

How should .htaccess

1

There are 1 answers

0
Gökçek Gıda On
RewriteEngine on
RewriteCond %{HTTP_HOST} !^www\.
RewriteCond %{HTTP_HOST} ^(.+)\.domain\.com$ [NC]
RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f
RewriteRule ^(.*)/(.*).html /index.php?cat=%1&subcat=$1&url=$2 [L]

The original URL:

http://domain.com/index.php?cat=cats&subcat=subcats&url=stackoverflow

The rewritten URL:

http://cats.domain.com/subcats/stackoverflow.html