我有一个具有以下链接结构的 php 页面:
http://localhost/wisper/businesspage.php?profile=creativeartbd
所以我试图将此链接转换为以下样式:
http://localhost/wisper/creativeartbd
.htaccess 配置
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^businesspage/(.*?)/(.*)$/wisper/businesspage.php?profile=$1 [QSA,L]
但不能正常工作。我认为我的代码是错误的,你能告诉我吗?
谢谢你。
更新:
我的php页面代码如下:
echo "<h4><a href='businesspage.php?profile=$uname_d'>$uname_d</a></h4>";
现在它显示了这个链接:
http://localhost/wisper/businesspage.php?profile=creativeartbd
所以我想显示这个链接看起来像这样:
http://localhost/wisper/creativeartbd
更新 2:
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>";
echo "<a href='/wisper/$uname_d'>$uname_d</a>";
?>
<img src="<?php echo "$upload_directory/$profile_pic_d"; ?>" width="99"
height="100"/>
<?php
echo "</div>";
}