2014-10-01 127 views
0

我有一個網站,我正嘗試遷移到一個新的主機。遷移到新主機後,由於路徑不正確,所有圖像都會中斷。使用htaccess的網址重定向

站點被遷移到:

http://www.indianradio.net.au/indiantimes.com.au/

圖像路徑被打破,一個示例: http://www.indianradio.net.au/cms/fckeditor/editor/userfiles/image/Oct-14-Gaura.jpg

爲了工作,路徑需要是:

http://www.indianradio.net.au/indiantimes.com.au/cms/fckeditor/editor/userfiles/image/Oct-14-Gaura.jpg

什麼是最好的方法來改變噸他的網址的基礎:

http://www.indianradio.net.au/indiantimes.com.au/

所以他們都正常工作。

我的印象是我可以用.htaccess做到這一點,但我無法弄清楚如何做到這一點。任何幫助將非常感激!謝謝!

+0

你沒有一個地方去改變圖像路徑嗎? htaccess不是一個好的理念,因爲那裏的所有規則都會在每個請求中被解析。 – 2014-10-01 07:41:48

回答

1

您可以使用此:

RewriteCond %{REQUEST_URI} !/indiantimes.com.au/.* RewriteRule ^(.*\.(gif|jpg|png))$ indiantimes.com.au/$1 [L] - 未經測試的

但我強烈建議更換尋找一種方法不使用htaccess的改變劇本和圖像路徑 。