好吧,我尝试使用通配符创建临时重定向:
http://www.example.com/index.php?topic=1578.0
至http://www.example.com/demo/showthread.php/1578
这是我的htaccess:
RewriteEngine on
RewriteBase /
# Rules for topics:
RewriteRule ^index.php\?topic=([0-9\.0]+)$ /demo/showthread.php/$1
# Rule for homepage
RewriteRule ^index.php$ /demo/forum.php
我的问题在于主题规则。它只是不重定向。你能指导我正确的方向吗?
答案 0 :(得分:2)
无法在RewriteRule中直接匹配查询字符串。
请改用:
RewriteCond %{QUERY_STRING} topic=([^&\s]+)
RewriteRule ^index.php /demo/showthread.php/%1? [L,R]