1

I'm using an Apache's mod_rewrite with PHP and when I need to add some CSS and JavaScript files, it's not working. I'm using a bootstrap file index.php where all my request are redirected in an htacces I wrote this rule :

RewriteEngine On
RewriteRule (.*) index.php [L]

I think that even the css and js files are redirected to my bootstrap file so I tried to evade them on the rule like this :

RewriteEngine On
RewriteRule (.*[^css,js,less,jpg,jpg,jpeg,png]$) index.php [L]

But the problem is that either my normal request didn't work.

Have you any suggestion to help me solve this problem ?

1 Answer 1

2

Give this a try it will prevent your files from going through your bootstrap:

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.*)$ index.php?/$1 [L]
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.