V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
caiem
V2EX  ›  问与答

遇到一个 htaccess 配置问题

  •  
  •   caiem · 2018-08-23 14:08:50 +08:00 · 397 次点击
    这是一个创建于 2090 天前的主题,其中的信息可能已经有所发展或是发生改变。

    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

    目前尚无回复
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   3245 人在线   最高记录 6547   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 27ms · UTC 14:19 · PVG 22:19 · LAX 07:19 · JFK 10:19
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.