How can .htaccess change $_SERVER[REQUEST_URI]?
I've a website at http://ex.com/web2/ this is a real path in my server,
but I wanted visitors to be able to access the website also over the URL
http://ex.com/web3/ (without changing the URL on the browser), so after
looking around (and asking help) I added the following to my .htaccess:
<IfModule mod_rewrite.c>
Options +FollowSymLinks -MultiViews
RewriteEngine On
RewriteBase /
RewriteRule ^web3/?$ /web2/ [L,NC]
RewriteRule ^web3/(.+)$ /web2/$1 [L,NC]
</IfModule>
The "silent" redirect that DOES NOT change the browser URL works fine, but
in PHP if I print $_SERVER[REQUEST_URI] I get the URL the user placed on
the browser, /web3/ instead of /web2/.
Is there any way .htaccess can also "fake" the path that is sent to the
PHP var? (I was told this would be hard or even impossible.)
Thank you.
No comments:
Post a Comment