Hello,
I have two .htaccess files, one in the root folder and one in the folder /test. What I want to do is redirect any request (.*) toward test/some/additional/info/$1, then in the test folder use that additional info somehow.
Now the problem is that when the request gets to the test folder, it gets rewritten into $1/additional/info/$1, instead of the desired $1.
Here is the .htaccess from the root folder:
RewriteEngine on
RewriteCond %{HTTP_HOST} ^localhost$
RewriteRule ^(.*)$ test/some/additional/info/$1 [L,NC]
And here is the .htaccess from the test folder:
RewriteEngine on
RewriteRule ^/?(some/additional/info)/(.*)/?$ $2 [NC,E=someAdditionalInfo:$1]
RewriteRule ^([0-9a-zA-Z_\-~\%\/,]+)$ ?cmd=$1 [L,NC]
When I look at the logs, the server is doing what I want it to here:
127.0.0.1 - - [19/Aug/2008:17:58:49 +0300] [localhost/sid#1801f90][rid#7f95aa8/initial/redir#1] (2) [perdir C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/aziincluj/test/] rewrite 'some/additional/info/dtest/ok/now' -> 'dtest/ok/now' - great!
, and the weird (for me, at least) replacement is done a couple of steps after:
127.0.0.1 - - [19/Aug/2008:17:58:49 +0300] [localhost/sid#1801f90][rid#7f95aa8/initial/redir#1] (3) [perdir C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/aziincluj/test/] add path info postfix: C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/aziincluj/test/dtest/ok/now -> C:/Program Files/Apache Software Foundation/Apache2.2/htdocs/aziincluj/test/dtest/ok/now/additional/info/dtest/ok/now - bad! why is this happening?