I've just installed a fresh apache (Apache/2.4.7 - Ubuntu) and created and enabled a site with a Document Root of /var/www/html
. With mod_rewrite enabled, I proceeded to create a simple .htaccess file in the that directory. I then added the standard:
Options +FollowSymlinks
RewriteEngine on
Then I started creating a RewriteRule. Since .htaccess is usually not terribly friendly, I typically create redirects by first sending the result as a parameter to a temporary php file which just dumps $_GET so that I can see what is happening. So my rewrite rule starts from the basic:
RewriteRule ^(.*)$ test.php?name=$1
And my test request: /test/path.html
Expected result: [name] => test/path.html
Actual result: [name] => test.php
WTH?
It's as if a 301 redirect had already somehow taken place. I seem to have no way to get the actual request path. Moreover, when checking server variables that should have the path like %{PATH_INFO}
, %{ORIG_PATH_INFO}
, they come up empty and %{REQUEST_URI}
returns /test.php
.
I've tried adding AcceptPathInfo On
to the .htaccess but that has no effect. I've also tried adding RewriteBase /
but this also has no effect. Also, I'm getting the same results after moving the rewrite rule to my .conf
file.
Any idea what might be going on here?