Wednesday 16 March 2016

php - 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


Answer



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



Example:




Options All
AllowOverride All
Order allow,deny

Allow from all


No comments:

Post a Comment

c++ - Does curly brackets matter for empty constructor?

Those brackets declare an empty, inline constructor. In that case, with them, the constructor does exist, it merely does nothing more than t...