我正在開發一個核心PHP網站,當有人在域名後輸入無效URL時,我希望網頁自動重定向到我的自定義頁面(404.php)。例如,我有一個URL,如www.abcdefg.com/abcd.php,如果有人輸入www.abcdefg.com/abzzcd.php,而不是顯示404錯誤,我想顯示自定義消息。.htaccess在本地機器上正常工作,但在服務器上無法正常工作
它在本地機器(XAMPP - localhost)中正常工作。網站託管在HostDime中。
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /sunday/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /sunday/404.php [L]
</IfModule>
是否在服務器中啓用了「mod_rewrite」? –
@PraveenKumar:我不知道那位先生。你能告訴我如何檢查它嗎? –
vps? windows vps? – WEBjuju