MY URL: http://localhost/test.php
I am using:
.htaccess:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.+)$ index.php?url=$1 [QSA,L]
PHP:
$url = $_GET['url'];
echo var_dump($url);
But all I get for $url is:NULL NULL NULL NULL NULL NULL
Edit: adjusted to handle both the redirect and the rewrite.
You should exclude the
RewriteCond %{REQUEST_FILENAME} !-d
condition, as it will attempt to access a directory if your URL matches it. Probably not desirable when doing url rewriting.index.php
I just wanted to leave this somewhere for future users. This removes both HTML and PHP extensions from URLS.