I use WampServer
(Apache/PHP/MySQL) and I have the following files in my www
directory:
www
[dir]test
[dir]index.php
[file].htaccess
[file]
I want to pass all URI requests as a parameter to index.php
without causing any external redirects (location changes in client browser). So I tried to use the following rule:
RewriteRule ^(.*)$ index.php?path=$1 [nocase,qsappend,end]
Which works quite good, except when the URI is /test
, in which case an external redirect changes the location to:
/test/?path=test
How can I make sure the external redirect does NOT happen even if the directory of the same name as the URI exists?
Expected result:
- Original URI request:
/test
- Internal redirect:
index.php?path=test
- External redirect: none
Actual result:
- Original URI request:
/test
- Internal redirect:
index.php?path=test
- External redirect:
/test/?path=test
The ideal solution would be universal and would not apply only to test
directory, but to any directory.