我得与我想改写到一个不同的子域查询字符串的链接。我已经试过如下:国防部重写与查询链接到其他子域
RewriteRule ^/forum/viewtopic.php(.*)$ http://sub2.domain.com/viewtopic.php$1 [R=301,L,QSA]
还有:
RewriteCond %{QUERY_STRING}
RewriteRule ^forum/viewtopic.php(.*) http://sub2.domain.com/forum/viewtopic.php?%1
你可以想像,它没有飞起来。我见过的大多数示例都涉及到指定实际的查询字符串,但是,我的链接有几个变量传递,并不总是以相同的顺序。是否有可能改写基于viewtopic.php一个URL(任何以后)
原文链接:
sub1.domain.com/forum/viewtopic.php?p=123&sid=c75edda9
sub1.domain.com/forum/viewtopic.phpt=321&start=0&postdays=0&sid=6e97b05
sub1.domain.com/forum/viewtopic.php?t=45&view=next&sid=f799
新链接:
sub2.domain.com/forum/viewtopic.php?p=123&sid=c75edda9
sub2.domain.com/forum/viewtopic.php?t=321&start=0&postdays=0&sid=6e97b05
sub2.domain.com/forum/viewtopic.php?t=45&view=next&sid=f799
此规则起作用。 'code' RewriteRule^forum/viewtopic.php(。*)$ http://sub2.domain.com/forum/viewtopic.php%1 [R,L]'code' – ahmeddirie 2011-04-19 19:06:29