2013-08-23 63 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