View Full Version : htaccess - Rewrite root folder?

06-13-2011, 11:44 AM
I've had a good look on Google but couldn't see any examples of my scenario... or none that I could understand lol.

Here's my situation. I have a htaccess rewrite that takes the url http://www.mydomain.com/advert and points to http://www.mydomain.com/adverts/juneadvert/index.php This works fine, however, I want all the source code paths (javascript, css etc) to use the /advert slug too. That way the true path is hidden from the user.

E.g. I dont want: http://www.mydomain.com/adverts/juneadvert/css/style.css

I do want: http://www.mydomain.com/advert/css/style.css

Is this possible?

06-13-2011, 02:06 PM
Someone over at Stack Overflow solved this for me :)

Options -Indexes -MultiViews +FollowSymLinks
RewriteEngine On

RewriteRule ^advert/((css|js)/.*)$ /adverts/juneadvert/$1 [L,NC]