BenjaVR BenjaVR - 5 months ago 25
PHP Question

WAMP automatically adds .php extension to file with RewriteRule

I am trying to rewrite my url with apache .htaccess (rewriting) as following:

RewriteEngine On
RewriteBase /

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-l

RewriteRule ^(.+)/?$ index.php?url=$1 [QSA,L]

My small project structure is:

  • .htaccess

  • index.php

  • test.php

Everything works fine, whatever I type after the "/" is in my $_GET["url"] variable. But as soon as I type in, it somehow automatically adds the .php extension to my url and leaves my $_GET["url"] empty. Same story when I try it goes to test.php instead of rewriting to

The strangest thing is that on it all works perfectly! When I upload the same file(s), its shows up the index and test in my $_GET["url"] variable.

Hope someone can help me!



It was because the Multiviews option was enabled. Removing this one fixed the problem.