我在使用.htaccess重写URL时遇到了一些麻烦,这是我使用的htaccess代码
RewriteRule "^([ \w-]+)/?$" /future/topic?post=$1&title=$2 [L,NC,QSA]
但是它不起作用
和URL代码:
<?php echo ("<p><a href='topic?post=$id&" . $slug . "'>" . $title . "</a>"); ?>
您没有传递htaccess
中定义的两个参数。您的标题参数丢失。
通过执行此操作纠正
<?php
echo "<p><a href='topic?post=$id&title=$slug'>$title</a>";
//when using double quotes a lot of things can be based directly mostly variables
?>
希望这会有所帮助