php - $_SERVER['PHP_SELF'] shows different after writing .htaccess -


this our site actual url

http://www.globalmedicalaware.com/gma-new/home.php?city=chennai

i rewrite url using .htaccess following code

options +followsymlinks rewriteengine on rewriterule /city/(.*) home.php?city=$1 

now url rewrite to

http://www.globalmedicalaware.com/gma-new/home/city/chennai

i written code in column-right.php , in other area footer,..etc,.. this

if($_server['php_self']=='/gma-new/home.php') {  ------------   designs , action display column right home.php -----------   }  

in localhost $_server['php_self'] shows /gma-new/home.php correctly..

but in live site $_server['php_self'] shows city/chennai..so column right coding home.php not working..

please me this..

you may try instead in .htaccess file @ root directory:

options +followsymlinks -multiviews rewriteengine on rewritebase / rewritecond %{request_uri} !home\.php  [nc] rewriterule ^gma-new/home/city/([^/]+)/?  /gma-new/home.php?city=$1  [l,nc] 

maps silently:
http://www.globalmedicalaware.com/gma-new/home/city/chennai to
http://www.globalmedicalaware.com/gma-new/home.php?city=chennai

where chennai dynamic string.

for permanent , visible redirection, replace [l,nc] [r=301,l,nc]


Comments

Popular posts from this blog

asp.net mvc 3 - Using mvc3, I need to add a username/password to the sql connection string at runtime -

kineticjs - draw multiple lines and delete individual line -

thumbnails - jQuery image rotate on hover -