I recently upgraded a site and almost all URLs have changed. I have redirected all of them (or so I hope) but it may be possible that some of them have slipped by me. Is there a way to somehow catch all invalid URLs and send the user to a certain page and somehow know what URL the person came from so I could log this, and fix those? I'm thinking I could use .htaccess somehow but am not sure how. I am using PHP Thanks so much!
error file is already in .htaccess but seems nothing going to change
you can see the error file as below
AddHandler application/x-httpd-php5s .php
ErrorDocument 404 /content/404.php
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteBase /
to see the problem what i want result is i need some thing to redirect if some one types wrong url just check the link even if you delete half of the location at the endof url it still opens
http://adsbuz.com/classifieds/abu-dhabi-uae/
it sholud go to the error page but its not giong i neeed some kind force to push it to error page
thanks
Best Answer
You can create a custom 404 file. Assuming you are using Apache you would add the following line to your .htaccess
This code basically tells the server that if a user encounters a 404(Page not Found) Error to display errorfilename.php.
In this PHP file you can add either code to email you when a user gets to the 404 page or add other logic to support
In PHP to get the location of the 404 page you would use the following global variable
Example of your 404.php page