当我输入超出我的网址路径的任何内容时,例如:http://example.com/doctorlist/ngffghf5235235 ,我希望它重定向到我的主页,即.. http://example.com 。我该怎么做 。 我的 .htacess 如下
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]
最佳答案
将每个请求重定向到某个页面,例如index.php
RewriteRule (.*) /index.php [L]
希望这有帮助
关于php - url 重定向到 "HOME"页面,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18404063/