Is it possible to use .htaccess to rewrite a sub domain to a directory like that?
Example:
http://sub.example.com/mycategory
shows the content of
http://example.com/subdomains/index.php?user=sub
http://example.com/subdomains/category.php?user=sub
I am using this for first example but not working with category example,
RewriteEngine on
RewriteCond %{HTTP_HOST} ^sub.domain.com
RewriteRule ^(.*)$ /subdomains/index.php?user=$1 [L,NC,QSA]
this is not working,
RewriteRule ^(.*)/mycategory$ /subdomains/category.php?user=$1 [L,NC,QSA]
CodePudding user response:
for First condition use,
RewriteRule ^()$ /subdomains/index.php?user=$1
and for Second condition use,
RewriteRule ^mycategory$ /subdomains/category.php?user=$1