RuZk
RuZk

Reputation: 103

Rewrite rule for subfolder

I have the file structure

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

First .htaccess:

RewriteEngine On
RewriteBase /

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

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

Second (news/.htaccess)

 RewriteEngine On
 RewriteRule . /index.php

Request http://test.t/news/news/61 the handles first index.php but I need to do it the second

I tried a few more options for the first .htaccess, but it did not succeed

Upvotes: 5

Views: 4732

Answers (1)

Levi
Levi

Reputation: 2113

Check your Apache config file (httpd.conf) and make sure the directory you are using for your site includes the AllowOverride option.

Example:

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

Upvotes: 3

Related Questions