Mod-Rewrite Dynamic URLs



我已经搜索,搜索,尝试并尝试了2天,现在就如何使自己在我要教我的自我php的CMS上如何使自己成为友好的URL。

我正在尝试更改:

www.mydomain.com/cms/index.php?id=30

to:

www.mydomain.com/cms/30

首先,我已经创建了另一个功能将其从ID更改为SEOURL,但我什至无法使基本数字版本正常工作。

我尝试了如何编写我的.htaccess文件的数百个组合,这是我当前的目前看来什么都不做的:

    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule cms/index/id/(.*) cms/index.php?id=$1
    RewriteRule cms/index/id/(.*)/ cms/index.php?id=$1

我的URL是如何创建的:

    $sqlCommand = "SELECT id, linklabel, seourl FROM pages WHERE showing='1' ORDER BY pageorder ASC";
        $query = mysqli_query($myConnection, $sqlCommand) or die (mysqli_error());
    $menuDisplay = '';
        while ($row = mysqli_fetch_array($query)) {
            $pid = $row["id"];
            $linklabel = $row["linklabel"];
            $seourl = $row["seourl"];
    $menuDisplay .= '<a href="index.php?id=' . $pid . '">' . $linklabel . '<a><br .>';
}
mysqli_free_result($query);

有人对我做错了什么有任何想法或解决方案?

谢谢

怎么样:

RewriteRule cms/([/d]+) cms/index.php?id=$1

最新更新