Reputation: 2975
I have a file structure like this:
my goal is to redirect every request to public/index.php
This is what I have in my current root .htaccess
RewriteEngine on
RewriteRule ^([^?]*)$ public/index.php [NC,L,QSA]
it redirects everything, but then my link to css file stops working. The response header for css file shows Content-Type:text/html
, so I suspect its the htaccess has messed up my content-type
My goal: simply deny access to app folder and redirect all to public/index.php (except js/css types of files)
update: I also found this line in my chrome console:
Resource interpreted as Stylesheet but transferred with MIME type text/html
Upvotes: 0
Views: 242
Reputation: 22821
Usually you would combine the rule you have with rules that don't redirect if the file or directory exists:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ public/index.php [NC,L,QSA]
If you really only want js/css files to be ignored, you could say:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !.+\.(js|css)$
RewriteRule ^(.*)$ public/index.php [NC,L,QSA]
Upvotes: 1