V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
caiem
V2EX  ›  问与答

遇到一个 htaccess 配置问题

  •  
  •   caiem · Aug 23, 2018 · 667 views
    This topic created in 2814 days ago, the information mentioned may be changed or developed.

    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

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3232 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 31ms · UTC 14:36 · PVG 22:36 · LAX 07:36 · JFK 10:36
    ♥ Do have faith in what you're doing.