当我输入超出我的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