2011-04-19 94 views
0

我想這樣的一個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重寫URL - 動態URL剝離

到這樣的事情:http://www.piata-bio.ro/presa-bio.php?var1=www.eva.ro/divertisment/stiri/un-nou-concept-de-magazin-articol-35491.html

基本上我想要去除,以谷歌新聞的一部分,只有保持與最終網址(沒有「http://」)。

我一直在嘗試各種解決方案,但目前爲止沒有任何工作。 僅供參考 - 我使用wordpress

任何幫助將不勝感激。

htaccess文件:

RewriteCond %{QUERY_STRING} url=(?:http://)?(.*) 
RewriteRule presa-bio.php presa-bio.php?var1=%1 [L] 

(如:?不會的RewriteCond工作,失去它,並使用%

<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 

回答

0

你可以通過匹配的的RewriteCond查詢字符串做2代替下一個規則中的%1)。

+0

感謝您的重播。不幸的是它沒有工作。網址沒有變化。 – 2011-04-19 13:22:01

+0

@Mike Johnson:請將您的.htaccess發佈爲編輯(使用代碼格式)將更加清晰! (並且可以幫助其他人嘗試制定答案) – 2011-04-19 13:24:12

+0

如果這不起作用,您可以添加更改爲[L,R],以便在瀏覽器中查看重定向帶您的位置? – 2011-04-19 13:33:38