I have problem with css when use this htacces code RewriteEngine On RewriteRule ^([^/])/([^/])$ /index.php?id=$1&page=$2 [L]

mode_rewrite work ok but css is not :(
How to fix?

Recommended Answers

All 5 Replies

Can you explain better? Are you referring to the css directory? You can disable the rewrite for some directories by adding this rule above yours:

RewriteRule ^(css|images|js|fonts) - [L]

If this does not solves then paste the entire rewrite rule and explain the issue, bye.

Thanks cereal work fine with your help!

Sorry i have problem that I have not noticed
when put code for mod_rewrite for url then my css not work but when put

 RewriteRule ^(css|images|js|fonts) - [L]

then css work but url not! :(

What kind of error do you get? Have you verified the error and access log files of your web server? From these files you can check the generated error codes.

This is working for me:

RewriteEngine On
RewriteRule ^(css|images|js|fonts) - [L]
RewriteRule ^([0-9]+)/([a-zA-Z0-9_-]+)$ index.php?id=$1&page=$2 [L]

If you try to access directly to the CSS file what header responses and contents do you get? If it is not configured properly, the server will try to return the index page contents instead of the CSS file. Usually the browser will return a blank page or will not reload. So you can try to debug by using:

curl http://localhost/css/file.css

If you don't have access to a cURL client, then you can use POSTMan, an extension for Google Chrome:

Once installed just open the tab and paste the URL of the CSS file, perform a GET request and see what you get.

Another possible solution is to place an .htaccess file inside the CSS directory, in this file you have to disable the rewrite engine:

RewriteEngine Off

Bye.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.