At the moment, I'm having trouble with loading some of css, js and image files when I use RewriteRules to rewrite my URLs.
Contents of my .htaccess are:
<IfModule mod_rewrite.c>
RewriteEngine On
Options +FollowSymlinks
# Options +SymLinksIfOwnerMatch
RewriteBase /
RewriteRule ^([^/]+)/([^/]+)/([^/]+)/?$ news.php?newstype=$1&newsid=$2&newstitle=$3 [L,QSA,NC,B]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^(.*)$ $1.php
# RewriteRule ^(css|js|img)/?$ /$1 [L,QSA,R=301]
</IfModule>
Here is the structure of my site:
[root]
css
vender
bootstrap.css
plugin
plugin.css
style.css
js
vender
bootstrap.js
plugin
plugin.js
main.js
images
sliders
slider1.jpg
slider2.jpg
1.jpg
2.jgp
index.php
.htaccess
This is how I load my JS and CSS files:
/css/style.css
/css/vender/bootstrap.css
/css/plugin/plugin.css
/js/main.js
/js/vender/bootstrap.js
/js/plugin/plugin.js
Its load only style.css file and main.js files. Can anybody tell me, what is problem to not load other files which are inside a sub folder?
If I comment this line RewriteRule ^([^/]+)/([^/]+)/([^/]+)/?$ news.php?newstype=$1&newsid=$2&newstitle=$3 [L,QSA,NC,B], then every thing is working nicely.
I also tried changing relative path to absolute and adding <base href="/"> inbetween the <head> </head> tags. But either doesn’t work for me.
Hope somebody may help me to figure this out.