我有麻烦redirect(通过.htaccess)这样的url:
www.url.com/index.php?option=com_content&task=view&id=60&Itemid=22
至
www2.url.com/something.htm
我发现问题是“旧”的URL。 一个“正常的”redirect(www.url.com/test.htm – > www2.url.com/something.htm)的效果很好。
我也尝试过重写,但找不到可行的解决scheme。
也许有人有想法如何解决我的问题?
非常感谢Lars。
仅供参考:服务器:Apache和我有完全的根访问服务器
编辑使用的重写规则:
我在.htaccess中使用重写规则尝试了以下内容
testing1:
RewriteCond %{QUERY_STRING} option=com_content&task=view&id=63&Itemid=11 RewriteRule $ www2.url.com [R=301,L]
结果1:redirect到www2 url,但不仅限于www2.url.com。 它redirect到www2.url.com/option=com_content&task=view&id=63&Itemid=11
testing2:
RewriteRule ^option=com_content&task=view&id=63&Itemid=11$ www2.url.com [R=301,L]
结果2:什么都没发生。 感谢您的提示:-)
对于www域vhost:
<VirtualHost *> ServerName www.url.com RewriteEngine on Rewritecond %{HTTP_HOST} !^www2\.url\.com RewriteRule (.*) http://www2.url.com/$1 [R=301,L] </VirtualHost>
然后在www2:
<VirtualHost *> ServerName www2.url.com RewriteEngine on RewriteCond $1 index.php\?option\=com_content\&task\=view\&id\=60\&Itemid\=22 RewriteRule (.*) http://www2.url.com/something.html [R=301,L] </VirtualHost>
想出了如何解决我的问题 – 感谢所有的小费,在我的方式来解决这个问题。
我在我的www.url.com域的httpdocs根文件夹中添加了以下条目到我的.htaccess文件中:
Options +FollowSymLinks RewriteEngine on RewriteBase / RewriteCond %{THE_REQUEST} ^[AZ]{3,9}\ /index\.php\?option=com_content&task=view&id=12&Itemid=11\ HTTP/ RewriteRule ^index\.php$ http://www2.url.com/?p=77 [R=301,L]