5
例如,我想将所有404错误重定向到“404.php”。使用.htaccess重定向到404错误的php/html文件
我试过在.htaccess中使用ErrorDocument 404 /404.php
,但没有运气,也许我的其他规则不允许这种方式,我不太确定,因为我无法在www上找到这个信息。
如果任何人都知道如何解决这个问题,请喊:P
我目前的.htaccess
#### pie thingy ####
AddType text/x-component .htc
#### Rule for Error Page - 404 ####
ErrorDocument 404 /404.html
#### url rewriting ####
Options +FollowSymlinks
RewriteEngine on
#### REDIRECT IF NO SUB-DOMAIN ####
RewriteCond %{HTTP_HOST} ^([^.]+)\.([^.]+)$ [NC]
RewriteRule ^(.*)$ http://www.%1.%2/$1 [R=301,L]
#### Remove "www." from any subdomain requests ####
RewriteCond %{HTTP_HOST} ^www\.([^.]+)\.precisehire\.com [NC]
RewriteRule (.*) http://%1.precisehire.com/$1 [R=301,L]
#### Rules for rewriting from PHP to HTML with fallback ####
RewriteCond %{REQUEST_URI} ^/(.*)\.html$
RewriteCond %{DOCUMENT_ROOT}/%1.php -f
RewriteRule ^(.*)\.html$ $1.php [nc]