I have the following .htaccess in the /backend folder:
RewriteEngine On
RewriteBase /backend
RewriteRule ^(.*)\.php$ index.php?path=$1 [L]
When I visit http://mysite.com/backend/test/pages/dashboard.php
$_GET['path'] returns the string "index" and not "test/pages/dashboard.php" as expected.
What am I doing wrong? I can't figure this out.
Solved this by adding the following rule before the other one.
RewriteRule ^index.php$ - [L]
TerryE pointed out:
In a perdir context the rewrite engine loops through the .htaccess files until it gets a clean pass.
mod_rewrite was in other words rewriting the url twice because the result of the first rewrite also matched the rule.