2014-05-14 21 views
0

我有一些外部網站指向我的網站的鏈接(下面的例子)是不正確的 - 他們需要有.html添加到最後。我試圖讓他們改變他們的一面,但不能 - 我怎麼能這樣做.htacess我手動將.html位添加到我想要添加到的url上?想要添加.html到某些網址(不是全部)使用.htacess

比如我有:

www.test.com/blue-boxes 

,這需要有www.test.com/blue-boxes.html

我想這一點:

RewriteRule ^(/blue-boxes)/?$ $1.html [L,R=301] 

但它不工作...任何想法?

回答

0

這個規則應該工作:

RewriteRule ^blue-boxes/?$ /blue-boxes.html [L,R=301] 

如果該URL爲www.test.com/blue-boxeswww.test.com/blue-boxes/會重定向到www.test.com/blue-boxes.html