Check for URLs that return my 404 error page
.htaccess files are extremely useful in many cases for users who either do not have root permissions or for users who simply aren't comfortable in making changes in their web server's configuration file. Trying to debug .htaccess not working isn't always the easiest thing to do, however, hopefully by checking the discuss below mentioned about htaccess, redirects, 404, , .htaccess common problems as well as the troubleshooting tips, you'll have a better grasp on what you may have to modify to get your .htaccess file running smoothly.Problem :I have made a custom 404 error page called error_404.html
In my .htaccess I inserted:
ErrorDocument 404 /error_404.html
In order to control/correct 404 errors in my website, I would like to know which URL requests return this page.
Is there a way I can check which URL or log requests that return the error_404.html page?
You do not need a custom error document in order to monitor 404's on your site - if that is the requirement. All the information is in your server access log. The HTTP response code (ie. 404, 403, 200, etc) and the URL of the request that produced that response.
The custom error document is a nice way of serving a meaningful response to users.
You can also register your site with Google Webmaster Tools (GWT). This will produce a report of all the URLs that it attempted to crawl (ie. URLs that it could find) that produced a 404.
Bare in mind that your access log will report a lot more 404s than GWT because there are a lot of nasty bots out there looking for vulnerabilities that will try to request all sorts of URLs that might be unrelated to your site. Ignore these, or block the bots if they are persistent.
I do not believe so. Not using ErrorDocument the way you have specified.
Here is a resource site that seems to have some answers.
http://www.askapache.com/htaccess/htaccess.html#Custom_ErrorDocuments
Scroll down and you will find this example. If it is not exactly what you want, it can be modified.
### ALTERNATATIVE TO USING ERRORDOCUMENT
# http://www.htaccesselite.com/d/htaccess-errordocument-examples-vt11.html
RewriteCond %REQUEST_FILENAME !-f
RewriteCond %REQUEST_FILENAME !-d
RewriteRule ^.*$ /error.php [L]
You can also check out for more information:
http://www.askapache.com/htaccess/security-with-htaccess.html#errordocument-usage-in-htaccess
This works: emulating ErrorDocuments with mod_rewrite.
ErrorDocument 404 /404.html
Redirect 404 /404
RewriteCond %ENV:REDIRECT_STATUS !=404
RewriteCond %REQUEST_FILENAME !-f
RewriteCond %REQUEST_FILENAME !-d
RewriteRule .* /404 [L]
Comments
Post a Comment