htaccess中的冲突规则会阻止404页面显示

时间:2015-07-17 15:52:39

标签: .htaccess web-development-server

我已经有条件检查不存在的页面并相应地显示404页面。但是,由于规则冲突,当我在子目录“cms”时,规则不起作用。我怎样才能解决这个问题?我的代码如下所示:

#This worked fine  
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d 
RewriteCond %{REQUEST_FILENAME} !-f 
RewriteRule ^ /404.html [L,NC]

#with this rule 404 would not show
#e.g. mywebsite.com/cms/non_existent.php would not show 404 page
RewriteRule ^events/  cms/callers.php [L]
RewriteRule ^event/(.*)/  cms/callingparty.php?eventid=$1 [L]
RewriteRule ^cms/(.*)/(.*)/ cms/showpage.php?param1=$1&param2=$2 [L]
RewriteRule ^cms/(.*)/ cms/showpage.php?param1=$1 [L]

0 个答案:

没有答案