views:

91

answers:

1

i wanna add a rewrite rule to apache 2.2 .htaccess file that if the rest of the rewrite rules did not comply and if the url is not found, to redirect to a specific php file. how do i do that ?

+4  A: 

A simpler solution might be to set up a custom 404 error page. Add something like this to your httpd.conf file...

ErrorDocument 404 /missingpage.php

If you just want a "catch all" rule that will be used if nothing else is a match, try something like this...

RewriteRule ^/(.*)$ /catchall.php?url=$1

This will need to be the last rule that apache finds though, as they are handled in the order they appear (as far as I know anyway...)

rikh
you helped a lot. thanks :)
ufk