这是我们网站的实际网址
http://www.globalmedicalaware.com/gma-new/home.php?city=Chennai
我使用.htaccess代码
重写网址Options +FollowSymLinks
RewriteEngine on
RewriteRule /city/(.*) home.php?city=$1
现在网址重写为
http://www.globalmedicalaware.com/gma-new/home/city/Chennai
我在column-right.php和其他一些区域写了代码,比如页脚,等等..这个
if($_SERVER['PHP_SELF']=='/gma-new/home.php') {
------------ some designs and action to display the column right for home.php only -----------
}
$_SERVER['PHP_SELF']
的localhost中的正确显示/gma-new/home.php
..
但在$_SERVER['PHP_SELF']
的实际网站中显示city/Chennai
..所以对于home.php的列权限编码不起作用..
请帮帮我..
答案 0 :(得分:1)
您可以在根目录的.htaccess文件中尝试此操作:
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]
默默地映射:
http://www.globalmedicalaware.com/gma-new/home/city/Chennai
到
http://www.globalmedicalaware.com/gma-new/home.php?city=Chennai
Chennai 是动态字符串。
对于永久和可见的重定向,将[L,NC]替换为[R = 301,L,NC]
答案 1 :(得分:0)
尝试在http://php.net/manual/en/reserved.variables.server.php中查看它,我认为您可以使用$_SERVER['PHP_SELF']
对$_SERVER['REQUEST_URI']
进行字幕翻译,以便:{/ p>
if ($_SERVER['REQUEST_URI'] == '/gma-new/home.php') {
/*
some designs and action to display the column right for home.php only
*/
}