2014-03-26 63 views
1

我需要刪除一部分url。 Google索引器正在檢測重複內容,我需要將網址重定向到主目標。用htaccess替換url

http://www.domain.com/index.php?id=123456.0 

to main target: 

http://www.domain.com/index.php?id=123456 

我要第一個URL重定向到第二個URL,通過消除.0和使用上htaccess的mod_rewrite的。

謝謝。

回答

1

可以在根.htaccess文件中使用這樣的規則:

RewriteCond %{THE_REQUEST} \s/+(index\.php\?id=[^.]+)\.0\s 
RewriteRule^/%1 [L,R=301] 
+0

工作正常!謝謝!!! – Maxpower

+0

不客氣,很高興它解決了。 – anubhava