I saw many similar problems to what I am experiencing but I already followed every solutions I get from it and it seems that I can't make it run without conflicts.
HTML CSS calls:
<head>
<base href="http://localhost/smartwavedev.sw_apiwebtool/" />
<link rel="stylesheet" href="assets/css/main.css" type="text/css">
<link rel="stylesheet" href="assets/css/login.css" type="text/css">
<link rel="stylesheet" href="assets/css/dashboard.css" type="text/css">
<link rel="stylesheet" href="assets/css/bootstrap/bootstrap.min.css" type="text/css">
<link rel="stylesheet" href="assets/css/docs.css" type="text/css">
</head>
.htaccess
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}\.php -f
RewriteRule ^([^/]+)$ $1.php
RewriteRule ^([^/]+)/([^/]+)$ $1.php?page=$2
RewriteRule ^([^/]+)/([^/]+)/([^/]+)$ $1.php?page=$2&nav=$3
Thanks for the help!
First of all this condition is malformed:
RewriteCond %{REQUEST_FILENAME}\.php -f
It should just be:
RewriteCond %{REQUEST_FILENAME} !-f
Now it will trigger on all files. Next up, a RewriteCond
will only match for the first RewriteRule
following it. So the third rule with the 3 elements is still matching (and thus blocking) your CSS files. You either need to repeat the RewriteCond
lines for all rules, or implement a better solution. For your specific case, I'd really recommend dropping the entire concept of rewriting and replace it with:
FallbackResource index.php
And then parse $_SERVER['REQUEST_URI']
in the index.php
file.