I need to rewrite a subdomain to a subdirectory using .htaccess but keep the subdomain in the url like this:
Visited url in browser: sub1.domain.com
Served url: sub.domain.com/sub1/
I tried the following
RewriteCond %{HTTP_HOST} ^subdomain.domain.com RewriteRule ^(.*)$ http://subdomain.domain.com/subdomain/$1 [L,NC,QSA] but this leads to an endless loop. I know that it would be easier to do this by php but is there any solution for this with using .htaccess?