0

我有一些导致最终格式不佳的网站,例如:

http://www.mydomain.com/directory/http%3A%2F%2Fwww.another.com%2Falink-that-doesnt-work

我想要一个重写规则来截断该部分直到 url 并修复编码以重定向到

http://www.another.com/alink-that-doesnt-work

谢谢

4

1 回答 1

0

使用正则表达式从 URL 中提取主机名和链接,并使用反向引用进行替换和重定向。请注意,模式与解码的 URL 匹配。

RewriteEngine On
RewriteRule   /directory/http://([^/]*)/(.*)    http://$1/$2   [R]
于 2013-03-08T13:24:16.703 回答