i have a question regarding .htaccess file access for css files and js files
i have this:
RewriteEngine On
RewriteBase /
RewriteRule ^$ index.php?page=index [L,NC]
RewriteRule ^([a-z0-9]+)/?$ index.php?page=$1 [L,NC]
RewriteRule ^([a-z0-9]+)/([a-z0-9]+)/?$ index.php?page=$1&subpage=$2 [L,NC]
now, i realize some files (like js, css) load correctly without using:
RewriteCond %{REQUEST_URI} !-f
will it be better if I add it before my rules, or it doesnt matter?
Usually it is safe to include
RewriteCond %{REQUEST_URI} !-fin Rewrite rules so that physical files like css, js, images etc are not affected by these rules.However in your case none of your rules will impact these css, js, images files because you are not including dot character
.in your matching reular expression.To overcome your issue I recommend using absolute path in your css, js, images files rather than a relative one. Which means you have to make sure path of these files start either with
http://or a slash/.