我已經與下面的鏈接結構的PHP頁面:PHP的mod_rewrite的工作不正常
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]
但是不工作propery。我認爲我的代碼錯了,你能告訴我嗎?
謝謝。
更新:
我的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>";
}
所以你想要相反?也就是說,重定向/wisper/businesspage.php?.../wisper/profilename?我認爲這不需要mod_rewrite,也許一個RedirectMatch可以滿足要求 –
我想讓url看起來像這樣。 localhost/wisper/profilename(suppose- creativeartbd)。請檢查我的更新。 – Alex
RedirectMatch? – Alex