ufk
ufk

Reputation: 32104

Apache .htaccess rewrite question

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 ?

Upvotes: 0

Views: 188

Answers (1)

Rik Heywood
Rik Heywood

Reputation: 13972

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...)

Upvotes: 4

Related Questions