我有一个 php 页面,它显示从 index.php 页面重定向的用户业务页面。
一些 Index.php 页面代码如下:
while($res = mysql_fetch_array($sql))
{
$mid = (int) $res['mid'];
$uname_d = inputvalid($res['uname']);
$profile_pic_d = inputvalid($res['profile_picture']);
$mid = base64_encode($mid);
echo "<div class='members'>";
echo "<h4><a href='businesspage.php?profile=$uname_d'>$uname_d</a></h4>";
?>
<img src="<?php echo "$upload_directory/$profile_pic_d"; ?>" width="99"
height="100"/>
<?php
echo "</div>";
}
现在它重定向到这个链接:
http://localhost/wisper/businesspage.php?profile=creativeartbd
所以我试图重定向此链接以显示如下所示:
http://localhost/wisper/creativeartbd
.ht 访问代码:
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond $1 !^businesspage.php
RewriteRule ^wisper/(.*?)$ wisper/businesspage.php?profile=$1 [R=301,QSA,L]
但不幸的是它不起作用。代码有问题吗?
更新:
现在 index.php 页面代码如下:
echo "<h4><a href='$uname_d'>$uname_d</a></h4>";
但是链接被重定向到我不想要的这种样式,并且它的显示对象未找到:
http://localhost/businesspage.php?profile=creativeartbd
我希望链接应该是这样的:
http://localhost/wisper/creativeartbd
.ht 访问代码
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteCond $1 !^businesspage.php
RewriteRule ^(.*?)$ businesspage.php?profile=$1 [R=301,QSA,L]