Rewrite subdomain to folder keeping the URL unchanged

I’m on a cheap shared hosting with Apache and I’m trying to do the following rewrite with .htaccess:

To do this I have the following .htaccess file in the root directory:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^(.*)\.domain\.com
RewriteRule ^(.*)$$1 [L,NC,QSA]
RewriteRule ^([^/\.]+)/([^/\.]+)/([^/\.]+)/?$ $1/index.php?section=$2&page=$3 [L]

And this works actually. The problem is that if I put to the web browser address string and press Enter, the string becomes like this:

(Note that the ‘digitalcameras’ moved from the beginning to the middle).

index.php placed in the /digitalcameras folder.

So the question is: can I do the same thing without changing the address in the browser?


Leave a Reply