.htaccessmod-rewriteurl-rewritinghttp-status-code-505

Rewrite everything to index.php?


This is a quick question. How do I change the .htaccess file to rewrite everything to redirect it to the index.php file?

When I'm removing the line of RewriteCond I'll get an 505 Internal Server Error.

This is my .htaccess file:

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule . index.php [L]

Solution

  • You can use this rule:

    RewriteEngine on
    
    RewriteCond %{REQUEST_URI} !\.(?:jpe?g|gif|bmp|png|ico|tiff|css|js)$ [NC]
    RewriteRule !^index\.php$ index.php [L,NC]