1

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]
AlexioVay
  • 4,338
  • 2
  • 31
  • 49

1 Answers1

1

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]
  • RewriteCond will skip this rewrite for image/css/js files.
  • Negative Expression !^index\.php$ means match anything except index.php.
anubhava
  • 761,203
  • 64
  • 569
  • 643