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