Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    Regular Coder
    Join Date
    Sep 2007
    Posts
    238
    Thanks
    9
    Thanked 0 Times in 0 Posts

    htaccess - Rewrite root folder?

    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/june.../css/style.css

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

    Is this possible?

  • #2
    Regular Coder
    Join Date
    Sep 2007
    Posts
    238
    Thanks
    9
    Thanked 0 Times in 0 Posts
    Someone over at Stack Overflow solved this for me

    Code:
    Options -Indexes -MultiViews +FollowSymLinks
    RewriteEngine On
    
    RewriteRule ^advert/((css|js)/.*)$ /adverts/juneadvert/$1 [L,NC]


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •