使用复杂的QUERYSTRING重定向



我正在将CRM从Joomla转移到Wordpress,作为过程的一部分,我想为一组现有页面设置一些重定向。当前的URL有点长:baseurl.com/sub_dir/index.php/component/civicrm/?task=civicrmm/pcp/info&重置=1&id=XX

我发现了几篇解释查询字符串重定向的文章,但在所有这些文章中,它们的变量都在".php?"后面。正如你所看到的,我的不是。我尝试了以下(以及一些类似的变体),但没有成功:

RewriteEngine on
RewriteCond %{QUERY_STRING} task=civicrm/pcp/info&reset=1&id=20$
RewriteRule ^sub_dir/index.php/component/civicrm/$ /path-to-new-location/? [L,R=301]

最后,我确实想用变量来写它(因为我们有几百个PCP,但我想先做点什么。)有什么想法吗?

您可以对多个URLss 进行尝试

RewriteEngine on
RewriteCond %{QUERY_STRING} ^task(.*)
RewriteRule ^sub_dir/index.php/component/civicrm/$ /path-to-new-location/? [L,R=301]

最新更新