1

I am trying to redirect all user requests to a bootstrap file, but when I do that the CSS and other files redirected.

How I can prevent this?

1
  • RewriteRule ^([^.*]+$) index.php?URL=$1 [TR,L] Commented Mar 26, 2014 at 22:05

1 Answer 1

3

You can preface your rewrite rule with the following two lines to check if a file/directory exists before rewriting:

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ...

If you want to whitelist only certain files/folders, you can exclude them in the rule itself:

RewriteRule ^(?!css|js|images|testfile\.php) ...
Sign up to request clarification or add additional context in comments.

1 Comment

Not Worked!Can You Write Full Code?Thanks

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.