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

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -