I would like to create a rule in .htaccess
if the page or folder does not exist redirect to url.php
Asked
Active
Viewed 1,590 times
-1

NullPoiиteя
- 56,591
- 22
- 125
- 143

kajab
- 135
- 1
- 9
-
If you want to use PHP only, see this thread http://stackoverflow.com/questions/2280394/check-if-an-url-exists-in-php – Zaheer Ahmad Awan Nov 29 '12 at 04:46
2 Answers
2
Just add this line to your root .htaccess file:
ErrorDocument 404 /url.php

John Conde
- 217,595
- 99
- 455
- 496
0
try ErrorDocument
ErrorDocument 404 /url.php
you can also use for 403,500 etc
ErrorDocument 403 /url.php
ErrorDocument 500 /url.php
or
RewriteCond %{HTTP_HOST} ^.*$
RewriteRule ^404.php$ http://www.example.com [R=301,L]

NullPoiиteя
- 56,591
- 22
- 125
- 143