Reputation: 433
How can I redirect everything to index page (like www.domain.com/anything) without messing up the css, img and js loading on this page?
Should this work?
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} !^/index.html
RewriteCond $1 !^(img|css|js|font)
RewriteRule ^(.*)$ /index.html [L,R=301]
Upvotes: 0
Views: 35
Reputation: 893
I tend to use:
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.php [QSA,L]
Where the RewriteCond -f
will match any regular file calls (which are negated with the !
). So you can call those normally and anything else (incl 404) are sent to the index.
Upvotes: 2