Currently, I have a 404 template—which EE is using via the Global Template Settings. I have the following code which redirects the user to the 404 page, should the link they requested not be found.
{exp:channel:entries channel="page" require_entry="yes"}
{if no_results}
{redirect="404"}
{/if}In addition to EE, I have “ErrorDocument 404 /404/index” within the .htaccess file.
The user IS directed to the 404 page, however it is still being tracking in the site analytics. For instance, if someone types http://www.site.com/whatever.htm—and is directed to a 404 page, it is counted as a result in the analytics.
I must note that even if the user is directed to a 404 page, the url remains the same. I’m guessing this is what is causing the discrepancies in the data. I’ve read this great blog on 404’s in EE and I still am getting this problem: http://joviawebstudio.com/index_ee.php/blog/guide_to_404_pages_with_expressionengine/
Server HTTP headers report that the page is indeed a 404.