Apache 2 mod_rewrite and PHP. Modify $_SERVER['REQUEST_URI'] value from htaccess? -


i have .htaccess file:

rewriteengine on  rewriterule ^hello$ goodbye  rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewritecond %{request_uri} !=/favicon.ico rewriterule ^ index.php [l] 

so i'm receiving requests on index.php, hello when asking hello, , expected receive goodbye when printing $_server['request_uri'] php.

that is, $_server['request_uri'] seems inmutable, when url has been rewritten before matching rewriterule referring index.php. there way modify value?

i want add thin , simple layer of url preprocessing existing code, without modifying php files. i'm trying stick inside .htaccess.

first of made mistake of not putting l or pt flag in first rule. code should this:

rewriterule ^hello$ goodbye [pt]  rewritecond %{request_filename} !-f rewritecond %{request_filename} !-d rewritecond %{request_uri} !=/favicon.ico rewriterule ^ index.php [l] 

once code there access variable in index.php:

$_server["redirect_url"] 

this have value: /goodbye

edit

if have mod_proxy enabled on host, can have first rule as:

rewriterule ^hello$ /goodbye [p] 

and have: $_server["request_uri"]=/goodbye


Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -