2013-08-23 61 views
0

當我輸入超出我的url路徑的任何東西時:例如:http://example.com/doctorlist/ngffghf5235235,我希望它重定向到我的主頁i,e .. http://example.com。我該怎麼做 。 我有我的.htacess如下url重定向到「HOME」頁面

RewriteEngine on 
RewriteCond %{SCRIPT_FILENAME} !-d 
RewriteCond %{SCRIPT_FILENAME} !-f 
RewriteCond %{REQUEST_FILENAME} !/(css|images|js)/ 
RewriteRule ^home/(.*)$ index.php [QSA] 
RewriteRule ^doctorlist/(.*)$ innerpage.php [QSA] 
RewriteRule ^appointment-list/(.*)$ detailspage.php?doc_id=$1 [QSA] 
RewriteRule ^register-plus-appointment-form/(.*)$  register_plus_appointment_form.php?doc_id=$1&time_id=$2&date=$3&time=$4 [L,QSA] 
RewriteRule ^appointment-form/(.*)$ appoint_form.php [L,QSA] 
RewriteRule ^appointment-confirm-form/(.*)$ appointment_form.php [L,QSA] 
+0

以防萬一你想最終鏈接到一些過去你家的路,但只有有效的鏈接,你可能要考慮制定一個自定義404頁面將重定向到您的主頁。有一個容易遵循指南在這裏http://www.thesitewizard.com/archive/custom404.shtml – Zycro

回答

1

到每個請求重定向到某個頁面,如index.php的

RewriteRule (.*) /index.php [L] 

希望這有助於

+0

這給我的第一頁,即首頁頁面內部服務器錯誤http://example.com – suppi

0

根據你的標籤,我想你需要你的Zend Framework應用程序。因此,這將做的工作:

RewriteEngine On 
RewriteCond %{REQUEST_FILENAME} -s [OR] 
RewriteCond %{REQUEST_FILENAME} -l [OR] 
RewriteCond %{REQUEST_FILENAME} -d 
RewriteRule ^.*$ - [NC,L] 
RewriteRule ^.*$ index.php [NC,L] 

參見:http://framework.zend.com/manual/1.12/en/zend.application.quick-start.html

+0

我需要它在覈心PHP 。 – suppi