dpmwy80068 2016-09-12 22:18
浏览 33

我有两个相同的.htaccess。 如何在根文件夹中创建一个?

Here is my .htaccess in root. Same one is in folder /enter

RewriteEngine On

RewriteCond %{SCRIPT_FILENAME} !-d
RewriteCond %{SCRIPT_FILENAME} !-f

RewriteRule ^([a-zA-Z0-9_-]+)$ index.php?content=$1
RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ index.php?lang=$1&content=$2

How do I turn on the folder "enter" in the root .htaccess and remove duplicate htaccess ?

  • 写回答

1条回答 默认 最新

  • dtcd27183 2016-09-13 08:23
    关注

    I think you're looking for this:

    RewriteEngine On
    
    RewriteCond %{SCRIPT_FILENAME} !-d
    RewriteCond %{SCRIPT_FILENAME} !-f
    
    ## Enter
    RewriteRule ^([a-zA-Z0-9_-]+)/enter$ enter/index.php?lang=$1&content=$2 [L]
    RewriteRule ^([a-zA-Z0-9_-]+)/enter/([a-zA-Z0-9_-]+)$ enter/index.php?lang=$1&content=$2 [L]
    
    ## Root
    RewriteRule ^([a-zA-Z0-9_-]+)$ index.php?content=$1
    RewriteRule ^([a-zA-Z0-9_-]+)/([a-zA-Z0-9_-]+)$ index.php?lang=$1&content=$2
    

    By the way: The [L] means "last": http://httpd.apache.org/docs/2.4/rewrite/flags.html

    评论

报告相同问题?

悬赏问题

  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号
  • ¥15 基于单片机的靶位控制系统