首页 文章

重写子文件夹的规则

提问于
浏览
2

我有文件结构

index.php
   .htaccess
   news/index.php
   news/.htaccess

首先.htaccess:

RewriteEngine On
    RewriteBase /

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

    RewriteCond %{REQUEST_URI} !^/news/
    RewriteRule . /index.php [L]

第二(新闻/ .htaccess)

RewriteEngine On
    RewriteRule . /index.php

请求http://test.t/news/news/61处理第一个index.php,但我需要在第二个

我为第一个.htaccess尝试了一些选项,但它没有成功

1 回答

  • 2

    检查Apache配置文件(httpd.conf)并确保您为站点使用的目录包含AllowOverride选项 .

    例:

    <Directory "/Applications/MAMP/htdocs">
        Options All
        AllowOverride All
        Order allow,deny
        Allow from all
    </Directory>
    

相关问题