E
E
evilelf2016-12-01 20:13:48
Apache HTTP Server
evilelf, 2016-12-01 20:13:48

How to make a 404 page?

Hello. I'm stuck, please help.
You need to make sure that at 404, the web/404.html page is shown.
Here is the current htaccess

AddDefaultCharset UTF-8
SetEnv TZ "Europe/Moscow"
ErrorDocument 404 /404.html
ErrorDocument 500 /404.html
Options All -Indexes

RewriteEngine on

#Redirect 301 /web/(.*) /$1

#RewriteCond %{THE_REQUEST} ^.*\/web\/(.*)$
#RewriteRule ^.*\/web\/(.*)$ $1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.*)$ $1.html

RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /(?=!yandex).*\.html\ HTTP/
RewriteRule ^(.*)\.html$ /$1 [R=301,L]
#RewriteRule ^(.*)\.html$ /$1 [R=301,L]

RewriteCond %{HTTP_HOST} ^www\.(.*)$
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]

RewriteCond %{THE_REQUEST} ^.*/index\.html
RewriteRule ^(.*)index.html$ /$1 [R=301,L]

RewriteCond %{THE_REQUEST} ^.*/index\.php
RewriteRule ^(.*)index.php$ /$1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^.*$ - [NC,L]
RewriteRule ^(.*)$ /web/$1 [NC,L]

#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteRule ^(.*)$ /web/404.html [L]

All files are in the ./web folder in the root of the site
.htaccess in the root of the site, along with git / gulp and other things

Answer the question

In order to leave comments, you need to log in

1 answer(s)
Z
zooks, 2016-12-01
@zooks

https://lmgtfy.com/?q=htaccess+404

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question