我在处理主机 (GoDaddy) 上的错误文档时遇到了一些麻烦。
这是我的 htaccess 内容:
AddHandler x-httpd-php5-4 .php
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(.+)$ index.php?route=$1 [L,QSA,NE]
ErrorDocument 404 /error/NotFound
ErrorDocument 403 /error/Forbidden
RedirectMatch ^/\+(.*)$ http://plus.google.com/[my_profile]
#Options All -Indexes
DirectoryIndex index.php
AddDefaultCharset UTF-8
DefaultLanguage es-PE
SetEnvIfNoCase User-Agent .*google.* search_robot
SetEnvIfNoCase User-Agent .*yahoo.* search_robot
SetEnvIfNoCase User-Agent .*bot.* search_robot
[...]
SetEnvIfNoCase User-Agent “(Ubuntu-feisty)$” bad_bot
Order Deny,Allow
Deny from env=bad_bot
#Deny from All
Allow from env=search_robot
<ifModule mod_gzip.c>
[...]
</ifModule>
<FilesMatch ".(ttf|otf|eot|woff)$">
<IfModule mod_headers.c>
Header set Access-Control-Allow-Origin "*"
</IfModule>
</FilesMatch>
#COUNTRY_BLOCK_START
<Limit GET HEAD POST>
order deny,allow
allow from [ip_range]
deny from all
</Limit>
有了这一切,自定义错误页面无法正常工作。