Если я добавлю директиву ErrorDocument
в файл .htaccess
, все перестанет работать. Теперь знаю, где моя ошибка. Затем я удаляю директиву ErrorDocument
, все снова работает.
Я пытался использовать путь относительно корня документа или полный URL-адрес. Пробовал также сделать в корне документа отдельную папку /err/errMsg.php
и ссылаться на нее ErrorDocument 100 http://localhost/domainname.biz/err/errMsg.php
, все же лучше было бы перенаправить на public/index.php/err/err action
.
Мой корень документа:
DOCUMENT_ROOT /home/name/public_html/domainname.biz on server
DOCUMENT_ROOT ...../apache2/htdocs on localhost
.htaccess
файл для localhost
:
ErrorDocument 100 /domainname.biz/public/index.php/err/err
#i also used ErrorDocument 100 http://localhost/domainname.biz/public/index.php/err/err
ErrorDocument 101 /domainname.biz/public/index.php/err/err
ErrorDocument 102 /domainname.biz/public/index.php/err/err
ErrorDocument 200 /domainname.biz/public/index.php/err/err
ErrorDocument 201 /domainname.biz/public/index.php/err/err
ErrorDocument 202 /domainname.biz/public/index.php/err/err
ErrorDocument 203 /domainname.biz/public/index.php/err/err
ErrorDocument 204 /domainname.biz/public/index.php/err/err
ErrorDocument 205 /domainname.biz/public/index.php/err/err
ErrorDocument 206 /domainname.biz/public/index.php/err/err
ErrorDocument 207 /domainname.biz/public/index.php/err/err
ErrorDocument 226 /domainname.biz/public/index.php/err/err
ErrorDocument 300 /domainname.biz/public/index.php/err/err
ErrorDocument 301 /domainname.biz/public/index.php/err/err
ErrorDocument 302 /domainname.biz/public/index.php/err/err
ErrorDocument 303 /domainname.biz/public/index.php/err/err
ErrorDocument 304 /domainname.biz/public/index.php/err/err
ErrorDocument 305 /domainname.biz/public/index.php/err/err
ErrorDocument 306 /domainname.biz/public/index.php/err/err
ErrorDocument 307 /domainname.biz/public/index.php/err/err
ErrorDocument 400 /domainname.biz/public/index.php/err/err
ErrorDocument 401 /domainname.biz/public/index.php/err/err
ErrorDocument 402 /domainname.biz/public/index.php/err/err
ErrorDocument 403 /domainname.biz/public/index.php/err/err
ErrorDocument 404 /domainname.biz/public/index.php/err/err
ErrorDocument 405 /domainname.biz/public/index.php/err/err
ErrorDocument 406 /domainname.biz/public/index.php/err/err
ErrorDocument 407 /domainname.biz/public/index.php/err/err
ErrorDocument 408 /domainname.biz/public/index.php/err/err
ErrorDocument 409 /domainname.biz/public/index.php/err/err
ErrorDocument 410 /domainname.biz/public/index.php/err/err
ErrorDocument 411 /domainname.biz/public/index.php/err/err
ErrorDocument 412 /domainname.biz/public/index.php/err/err
ErrorDocument 413 /domainname.biz/public/index.php/err/err
ErrorDocument 414 /domainname.biz/public/index.php/err/err
ErrorDocument 415 /domainname.biz/public/index.php/err/err
ErrorDocument 416 /domainname.biz/public/index.php/err/err
ErrorDocument 417 /domainname.biz/public/index.php/err/err
ErrorDocument 422 /domainname.biz/public/index.php/err/err
ErrorDocument 423 /domainname.biz/public/index.php/err/err
ErrorDocument 424 /domainname.biz/public/index.php/err/err
ErrorDocument 426 /domainname.biz/public/index.php/err/err
ErrorDocument 500 /domainname.biz/public/index.php/err/err
ErrorDocument 501 /domainname.biz/public/index.php/err/err
ErrorDocument 502 /domainname.biz/public/index.php/err/err
ErrorDocument 503 /domainname.biz/public/index.php/err/err
ErrorDocument 504 /domainname.biz/public/index.php/err/err
ErrorDocument 505 /domainname.biz/public/index.php/err/err
ErrorDocument 506 /domainname.biz/public/index.php/err/err
ErrorDocument 507 /domainname.biz/public/index.php/err/err
ErrorDocument 510 /domainname.biz/public/index.php/err/err
Options -MultiViews
Options -Indexes
Options +FollowSymlinks
# +FollowSymLinks must be enabled for any rules to work, this is a security requirement of the rewrite engine.
# Normally it's enabled in the root and you shouldn't have to add it, but it doesn't hurt to do so,
# Although highly unlikely, your host may have +FollowSymLinks enabled at the root level,
# yet disallow its addition in .htaccess; in which case, adding +FollowSymLinks will break your setup
# (probably a 500 error), so just remove it, and your rules should work fine.
RewriteEngine on
RewriteBase /
IndexIgnore *
RewriteCond %{HTTP_HOST} ^domainname\.biz [NC]
RewriteCond %{HTTPS} off
RewriteRule (.*) https://www.%{HTTP_HOST}%{REQUEST_URI}
RewriteCond %{HTTP_HOST} ^www.domainname\.biz [NC]
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
RewriteCond %{ENV:REDIRECT_STATUS} ^$
RewriteCond %{ENV:REQUEST_FILENAME} !-d
RewriteCond %{ENV:REQUEST_FILENAME} !-f
RewriteCond %{ENV:REQUEST_FILENAME} !-l
RewriteRule ^index.php?(.+)$ index.php?url=$1 [QSA,L]
.htaccess
файл на сервере такой же, но я начинаю с другого корня документа
ErrorDocument 100 /public/index.php/err/err
#or https://www.domainname.biz/public/index.php/err/err