.htacces
我对url 重写有问题。
我有一个文件夹dir
,里面有三个文件
.htaccess
是空的,i.php
也是空的,但在index.php
我有
$sql = mysql_query("SELECT * FROM clients ORDER By id DESC LIMIT 10");
while($row = mysql_fetch_array($sql)){
$url = "i/$row[id]/".preg_replace('/[^a-zA-Z0-9-_]/', '-', $row['company']);
echo "<a href='".$url ."'>".$row['company'].'<br/ ></a>';
}
当我将鼠标悬停在echo
输出上时,像
localhost/dir/i/101/today-in-news
localhost // is localhost obviously
dir // is a folder where I keep index.php and i.php files
i // is i.php
101 // is the id of the news
today-in-news // is the title of the news
所以,当我点击它时,它会把我带到我想要的地方,但我需要摆脱 id,在这种情况下,101
我希望链接只localhost/dir/i/today-in-news
在我点击它时出现。我已经尽我所能,但没有任何结果。