1

Im pretty new to this, but according to my logic this should work.

What i want to do is catch all urls that do not match any rules before the end, and redirect them to error.php. If i try to access localhost/create or localhost/create/ it still redirects me to error.php. Am I missing something?

RewriteEngine On

RewriteRule    ^create/?$    create.php    [NC,L]
RewriteRule ^ error.php [NC,L]
ventura
  • 13
  • 3

1 Answers1

1

This works for me:

Options +FollowSymLinks -MultiViews

RewriteEngine On
RewriteBase /

RewriteRule ^create/?$ create.php [NC,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ error.php [NC,L]

The problem with your rule is that it does not check if the file or folder exists so basically once it finds create.php it continues to the error.php because it was not asked to verify if the file existed.

Prix
  • 19,417
  • 15
  • 73
  • 132