yii2.0 框架下配置 htaccess 文件,目录下面有 index.php,activity.php 两个文件入口.但是访问 www.xxx.com/activity/index 时却会直接执行 activity.php 文件
RewriteRule ^([0-9]+)$ activity.php?activityId=$1&%{QUERY_STRING} [L] 原本我 htaccess 配置是想只有数字时才执行 activity.php,其他默认只执行 index.php 没有找到合适的解决方法.
在 windows wamp 环境有触发,linux 没有问题 web
--index.php
--.htaccess
--activity.php
//htaccess 文件内容 RewriteEngine on RewriteRule ^([0-9]+)$ activity.php?activityId=$1&%{QUERY_STRING} [L]
<ifmodule mod_rewrite.c=""> RewriteCond %{SCRIPT_FILENAME} -d RewriteCond %{SCRIPT_FILENAME} -f RewriteRule "(^|/)." - [F] </ifmodule> <filesmatch "(.(bak|config|sql|fla|psd|ini|log|sh|inc|swp|dist)|~)$"=""> Order allow,deny Deny from all Satisfy All </filesmatch>RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . index.php