Forum Moderators: phranque
ErrorDocument 404 /index.php
to divert anything that isn't found in the site to this page (I'm developing a call CMS that gets information from the URI once it diverts to index.php)
Can anyone tell me whether this will be logged in the server as a failed request? My server log files won't look to happy as this will be used as a navigation method...
(index.php sends a 200 ok header, so I'm not 100% sure if the servers logging kicks in on the header, or whether it detects the htaccess directive and logs that as well?)
Yes, it will log as a failed request -- and worse, search engine spiders will see it as a failed request as well, eventually removing that URL from their indexes. This is a bad technique to use for anything but a GeoCities hobby site, where you have no other implementation choices.
Look into using mod_rewrite [httpd.apache.org]: Specifically, test for file-exists using the "-f" flag of RewriteCond, and then internally rewrite the requested URL to your script if a 'real' file can't be found.
Jim
RewriteEngine On
RewriteRule ^[^-f-d]$ /index.php
I need to test for a non-file or non-directory and then divert to the index.php
(Thanks for your advice jdmorgan, I would have plowed on ahead unwittingly and I need something as search engine friendly as possible)