How to upload an Error 404 page to the website and another to the HTACCES application?

Asked

Viewed 72 times

0

.htacess of the site

 # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    # END WordPress

    # Redirecionamento http to https SSL Protocol

    RewriteEngine On
    RewriteCond %{HTTPS} off 
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}

    # END WordPress

    RewriteEngine On
    ErrorDocument 404 /404.html

.htacess of the System

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php/$1 [PT,L]


RewriteEngine On
ErrorDocument 404 /https://www.meusite.com.br/aplicacao/404.html
  • page 404.html is not loading. Is it because I’m testing on localhost? or has nothing to do with?

  • I’ve been able to make it work for the site, but for the application is not working.

1 answer

1

Both directives are wrong:

ErrorDocument 404 /http://localhost/www.meusite.com.br/404.html

And:

ErrorDocument 404 /http://localhost/aplicacao/404.html

The accepted formats are:

  • Errordocument 404 "Sorry, our script Crashed. Oh Dear"`
  • ErrorDocument 404 /errors/not_found.html
  • ErrorDocument 404 /subscription/how_to_subscribe.html
  • ErrorDocument 404 http://error.example.com/server_error.html

And in the case of the last one it will be redirected.

In your codes there’s one left / on the front, in fact it is quite likely that you want to pass is the document and not a URL, the correct then would be to pass the entire internal path, for example if in the DocumentRoot or in the VirtualHost apache is configured something like / for the first would be:

ErrorDocument 404 /www.meusite.com.br/404.html

And the other would be:

ErrorDocument 404 /aplicacao/404.html
  • htacess of the site is already working the problem is in the second, the application.

  • @Ramiro are not in correct format friend, where in virtualhost is the application?

  • htacess of the application is inside the folder of the application. The of the site, is inside the public_html folder

Browser other questions tagged

You are not signed in. Login or sign up in order to post.