Mobile app version of vmapp.org
Login or Join
Tiffany637

: Htaccess ErrorDocument 404 not working I am planning to replace WordPress on my site with custom HTML/CSS/JS, and I'm trying to check my .htaccess file will work. It is working, as I was able

@Tiffany637

Posted in: #Htaccess #InternetExplorer #Wordpress

I am planning to replace WordPress on my site with custom HTML/CSS/JS, and I'm trying to check my .htaccess file will work. It is working, as I was able to change the directory index with it, but for some reason ErrorDocument 404 /errors/404.html does not work. Instead, when I type a bogus URL, the standard browser 404 message appears.

I have tried just having that line in the htaccess file. I think it may be due to the WordPress folder, which I will delete once the new site is ready. Is this the problem?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @Tiffany637

2 Comments

Sorted by latest first Latest Oldest Best

 

@Ann8826881

the standard browser [MS Edge] 404 message appears.


It would seem you are seeing Internet Explorer / Microsoft's "Friendly HTTP Error Message". This is a feature that is enabled by default in IE (and it would seem Edge) browsers.

If the server response to some common errors (eg. 404, 500, ...) is less than 512 Bytes then IE's "friendly" error page is displayed instead.

If the error document is likely to be less than 512 Bytes then usual procedure is to simply pad the error document with a large HTML comment, to ensure that it is always larger than 512 Bytes!

You can also disable this (per user) in the browser. Under Internet Options > Advanced > Browsing, uncheck the "Show friendly HTTP error messages" option:



Reference: support.microsoft.com/en-us/kb/294807

10% popularity Vote Up Vote Down


 

@BetL925

WordPress has own 404 page. It is usually placed in /wp-content/themes/your-active-theme/404.php. The content of 404.php should be at least:

<?php get_header(); ?>

<h2>Error 404 - Page Not Found.</h2>

<?php get_sidebar(); ?>

<?php get_footer(); ?>


If you place your htaccess file IN the Wordpress directory, so the htaccess should contain the line:

ErrorDocument 404 /index.php?error=404


If you place your htaccess BESIDE, on the same directory level, where your WordPress directory is placed, so the htaccess content should be

ErrorDocument 404 /Folder-Name-Of-Wordpress-Installation/index.php?error=404

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme