重写URL-动态URL剥离

| 我想这样重写网址:http://www.piata-bio.ro/presa-bio.php?var1=http://news.google.com/news/url?sa=t&fd=R&usg=AFQjCNHmU7U7bXtlH9Lo8dXfBs64PqxgbA&url = http://www.eva.ro/divertisment/stiri/un-nou-concept-de-magazin-articol-35491.html 像这样的东西:http://www.piata-bio.ro/presa-bio.php?var1=www.eva.ro/divertisment/stiri/un-nou-concept-de-magazin-articol-35491.html 基本上,我想剥离到Google新闻部分,仅保留最终网址(不带\“ http:// \”)。 我一直在尝试各种解决方案,但到目前为止没有任何效果。 仅供参考-我使用wordpress 任何帮助将不胜感激。 htaccess文件:
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{QUERY_STRING} url=(?:http://)?(.*)
RewriteRule presa-bio.php presa-bio.php?var1=%1 [L]
RewriteRule ^index\\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
 # END WordPress
已邀请:
您可以通过匹配rewriteCond中的查询字符串来实现:
RewriteCond %{QUERY_STRING} url=(?:http://)?(.*)
RewriteRule presa-bio.php presa-bio.php?var1=%1 [L]
(如果?:不适用于rewriteCond,请松开它并在下一条规则中使用%2代替%1)。

要回复问题请先登录注册