I'm taking my first stab at creating a mini-MVC to better understand the concepts behind such a design. I'm using:
RewriteCond %[REQUEST_FILENAME] !-d
RewriteCond %[REQUEST_FILENAME] !-f
RewriteCond %[REQUEST_FILENAME] !-l
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
to rewrite my URLS and it works great except for my css and js files. I thought that the "!-f" line would take care of these, but if I run a script with:
<link rel="stylesheet" href="public/css/default.css" />
then, I think that it's still treating my link as something to be rewritten. Any help with this would be appreciated.
Indeed it should. Are you sure the CSS URL is correct? Perhaps it should be /css/default.css? What makes you think it's rewriting your link?
I just noticed a syntax error. You should be using curly braces, not square brackets.
That fixed it! And, for someone who doesn't typically work with Rewrites, for future debugging of this sort, is there a file that I could have viewed that would have told me that there was a syntax error?
No, there isn't. The best thing you can do is SEE any redirection by using the [R=301] flag to test.
This topic is now closed. New replies are no longer allowed.