重写子文件夹的规则

时间:2012-12-02 19:38:45

标签: php apache .htaccess mod-rewrite

我有文件结构

   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 个答案:

答案 0 :(得分:2)

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

示例:

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