将网址重定向到“HOME”页面

时间:2013-08-23 13:27:30

标签: php mysql

当我输入超出我的网址路径的任何内容例如:http://example.com/doctorlist/ngffghf5235235时,我希望它被重定向到我的主页i,e .. 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]

2 个答案:

答案 0 :(得分:1)

将每个请求重定向到某个页面,例如index.php

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

希望这会有所帮助

答案 1 :(得分: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