开发者

ErrorDocument doesn't seem to be working in my .htaccess

Can anyone advise please? I'd like to have the default page for visitors to my site as being index.php and for all non-existent pages the visitor should see errordoc.php

So I've put this in the .htaccess:

ErrorDocument 404 /errordoc.ph开发者_如何转开发p

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_HOST} !^mysite\.org\.uk$ [NC]
RewriteRule ^(.*)$ http://mysite.org.uk/$1 [R=301,L]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

Unfortunately everything is going to index.php, including errors. I've tried asking my friend Google but it's his day off today!


Your last rule will catch all requests that cannot be mapped onto existing files (RewriteCond %{REQUEST_FILENAME} !-f) or existing directories (RewriteCond %{REQUEST_FILENAME} !-d). That’s why the error document will not be served.


you have 2 incompatible sections in this file. choose one
leave either only first line or only the rest of the file. But not both.

Bottom three lines tells web-server to direct all non-existent pages to the index.php, not to errordoc.php

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜