Php Htaccess 301使用特殊字符将一个url重定向到另一个url无效
我需要将一个URL重定向到另一个URL。现在我在Php Htaccess 301使用特殊字符将一个url重定向到另一个url无效,php,.htaccess,mod-rewrite,redirect,http-status-code-301,Php,.htaccess,Mod Rewrite,Redirect,Http Status Code 301,我需要将一个URL重定向到另一个URL。现在我在.htaccess RewriteRule/forum/viewtopic.php?f=65&t=6/页面/页面名称[R=301] RewriteRule/forum/viewtopic.php?f=30&t=5/页面/页面的另一个名称[R=301] 但它根本不起作用。谁能帮我一下吗 提前非常感谢 使用重写规则无法匹配查询字符串。像这样使用它: RewriteEngine On RewriteCond %{QUERY_STRING} ^f=65&
.htaccess
RewriteRule/forum/viewtopic.php?f=65&t=6/页面/页面名称[R=301]
RewriteRule/forum/viewtopic.php?f=30&t=5/页面/页面的另一个名称[R=301]
但它根本不起作用。谁能帮我一下吗
提前非常感谢 使用
重写规则
无法匹配查询字符串。像这样使用它:
RewriteEngine On
RewriteCond %{QUERY_STRING} ^f=65&t=6$
RewriteRule ^forum/viewtopic\.php$ /page/name-of-the-page? [R=301,L]
RewriteCond %{QUERY_STRING} ^f=30&t=5$
RewriteRule ^forum/viewtopic\.php$ /page/another-name-of-the-page? [R=301,L]
?
最后用于去除任何现有的查询字符串
RewriteRule /forum/viewtopic.php?f=30&t=5 /page/another-name-of-the-page [R=301]
RewriteRule /forum/viewtopic.php?f=65&t=6 /page/name-of-the-page [R=301]
只要颠倒顺序就行了 你能让其他规则成功开火吗?您应该考虑配置ReWrimeLoG用于调试目的()是的,我有更多的规则,一切都有效,但这些简单的行不行。我想,问题在于?f=65&t=6等等,因为简单的重写规则/论坛//页面/页面名称[R=301]是有效的:(非常感谢,它不起作用,但我会尝试使用它,也许我会找到答案,只要确保这些是.htaccess中的前两条规则,并且确保
/forum/
文件夹中没有.htaccess。哈,它起作用了!我用/beforum/viewtopic\.php$而不是^beforum/viewtopic\.php$尝试了它,所以我有了/forum/viewtopic\.php$,它就像一个ch。)arm。非常感谢!顺便问一下,^应该做什么?^
在正则表达式中表示开始输入。