Here’s the basic information:
I’m using WAMP on Windows 8 64 bit. Apache 2.4.2, PHP 5.4+.
My project files are located in http://localhost/test/.
The .htaccess file in this folder is:
RewriteEngine on
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?$1 [L,QSA]
If I enter a URL like http://localhost/test/some/cool/stuff/, it works fine
i.e. in PHP: $_SERVER['QUERY_STRING'] = index.php&some/cool/stuff/
I wish it stripped the index.php& as well but I’m doing that in PHP.
While if I enter a URL like http://localhost/test/some/cool/stuff
the PHP $_SERVER['QUERY_STRING'] returns index.php&some/cool/stuff/&some/cool/stuff
Where’s this &some/cool/stuff/ part coming from?
I use
RewriteRule ^(.+)$ index.php [L]And then get the URL by
$_SERVER['REQUEST_URI']I use this function for PHP to get the request URL with fallback.