skip to Main Content

mydomain.pe on a Linux server with Apache, I have added the following line ErrorDocument 404 /404.html in .htaccess under RewriteEngine on

However when doing a false url test: abc.mydomain.pe/etc.html throws me a 404 error by default.

My 404.html file is visible through the web in the url: abc.mydomain.pe/404.html

Please your support, I have time and I have not been able to solve it by my side.

That could be happening? I share my .htaccess file:

<IfModule mod_rewrite.c>
RewriteEngine on
ErrorDocument 404 /404.html

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteCond %{REQUEST_URI} !^/[0-9]+..+.cpaneldcv$
RewriteCond %{REQUEST_URI} !^/[A-F0-9]{32}.txt(?: Comodo DCV)?$
RewriteRule ^(.*)$ $1.html

RewriteCond %{SERVER_PORT} 80
RewriteRule ^(.*)$ https://www.abc.mydomain.pe/$1 [R,L]

RewriteCond %{HTTP_HOST} !^www.abc.mydomain.pe$ [NC]
RewriteRule ^(.*)$ https://www.abc.mydomain.pe/$1 [L,R=301]

Header always set Strict-Transport-Security "max-age=31536000; includeSubDomains; preload"

RewriteCond %{HTTP_USER_AGENT} libwww-perl.* 
RewriteRule .* ? [F,L]
Options -Indexes
</IfModule>


<IfModule mod_headers.c>
<FilesMatch ".(js|css|xml|gz|html)$">
Header append Vary: Accept-Encoding
</FilesMatch>
</IfModule>

<IfModule mod_deflate.c>
    <filesMatch ".(js|css|html|php)$">
        SetOutputFilter DEFLATE
    </filesMatch>
</IfModule>

## EXPIRES CACHING ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access 1 year"
ExpiresByType image/jpeg "access 1 year"
ExpiresByType image/gif "access 1 year"
ExpiresByType image/png "access 1 year"
ExpiresByType text/css "access 1 month"
ExpiresByType text/html "access 1 month"
ExpiresByType application/pdf "access 1 month"
ExpiresByType text/x-javascript "access 1 month"
ExpiresByType application/x-shockwave-flash "access 1 month"
ExpiresByType image/x-icon "access 1 year"
ExpiresDefault "access 1 month"
ExpiresByType text/javascript "access 1 month"
</IfModule>
## EXPIRES CACHING ##

## INICIO compresión gzip (mod_deflate)
<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/shtml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
</IfModule> 
## FIN compresión gzip (mod_deflate)##

# php -- BEGIN cPanel-generated handler, do not edit
# Configure el paquete “ea-php56” como el lenguaje de programación predeterminado “PHP”.
<IfModule mime_module>
  AddType application/x-httpd-ea-php56 .php .php5 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit

2

Answers


  1. Chosen as BEST ANSWER

    I have been able to fix it by cPanel panel using "Error Pages", something curious, I noticed that a 404.shtml file ("s" added) was created, this is something new for me, maybe EasyApache 4 works now as well.

    Thank you for reading, Axel P.


  2. If your domain is mydomain.pe then your error document might be in the wrong place as you say it is in abc.mydomain.pe/404.html

    Maybe you should copy the file 404.html to mydomain.pe/404.html because Apache will look for it there. It should be accessible via mydomain.pe/404.html not via abc.mydomain.pe/404.html

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search