我建立了一个 Web 论坛,其链接如下所示:
http://127.0.0.1/website/comments.php?topic_id=2/create+good+seo+links
生成链接的链接如下所示
<a href="comments.php?topic_id=<?php echo (int)($forum_topic['topic_id']); >/<?php echo urlencode(htmlspecialchars($forum_topic['topic_head'])); > ">
问题:如何使链接看起来像
http://127.0.0.1/website/comments/topic/create-good-seo-links/2
我尝试在 .htaccess 文件中应用此代码:
RewiteEngine on
RewriteBase /website
RewriteRule ^comments/([a-zA-Z0-9_-)/([0-9]+)\.php$ comments.php?id=$1