What you are doing now, is telling the webserver to look for all non-existing pages and directories in another folder (_control). This does not give a solution for typo’s, non-existing pages etc. If you want to solve this, you could use:
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !^.*/_control/(admin|common).*$
RewriteCond %{REQUEST_FILENAME} !^.*/_control/site/.*$
RewriteRule ^(.*)$ site/errhandler.php?file=$1 [L]
and make a file called errhandler.php
, which displays a custom 404-page and (for example) give possible alternatives based on a database search or whatever. You could then use $_GET['file']
to display the original filename.
1
solved Apache 404 url not working