I have a following rule in .htaccess file:
RewriteRule orders\.html orders.php [L,NC]
How can I check in orders.php whether the user entered orders.html or orders.php as the request URL?
I want to redirect user to orders.html if he/she has orders.php in the address bar.
In order to get the originally requested URI from PHP after a ReWrite:
Try
$_SERVER['REDIRECT_URL']. In my experience, Apache’s mod_rewrite module populates theREDIRECT_URLvariable for CGI.$_SERVER['REQUEST_URI']should also be useful.Do
print_r($_SERVER);to see all the variables at your disposal.