I have this .htaccess
file:
RewriteEngine On
RewriteRule ^hello$ goodbye
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !
First of all you made a mistake of not putting L
or PT
flag in your first rule. Your code should be like this:
RewriteRule ^hello$ goodbye [PT]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^ index.php [L]
Once that code is there access this variable in index.php
:
$_SERVER["REDIRECT_URL"]
This will have value: /goodbye
If you have mod_proxy
enabled on your host, you can have your first rule as:
RewriteRule ^hello$ /goodbye [P]
And then you will have: $_SERVER["REQUEST_URI"]=/goodbye