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开发者_如何学Go 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?
All you need is just 1 line rule like this:
Options -Indexes -MultiViews +FollowSymLinks
RewriteEngine On
RewriteRule ^advert/((css|js)/.*)$ /adverts/juneadvert/$1 [L,NC]
精彩评论