Reputation: 5126
In my application, my javascript files are in the folder /web_root/inc/js/
, my images are in /web_root/inc/images/
, and my css files are in /web_root/inc/css/
.
I don't like the links, so I thought I'd use mod_rewrite on them. Is it recommended and/or possible to use mod_rewrite, so in my code I could include images, JS and CSS files just like in the following example:
<img src="images/img.png" alt="image" />
Instead of:
<img src="inc/images/img.png" alt="image" />
Upvotes: 0
Views: 38
Reputation: 691
In your web_root folder add an .htaccess file and include the next rules
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^images/(.*) http://%{HTTP_HOST}/inc/images/$1 [R=301,L]
</IfModule>
I did it and it worked for me.
Hope i help you
Upvotes: 1