簡體   English   中英

使用htaccess進行網址重定向

[英]Url redirect using 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/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做到這一點,但我不知道該怎么做。 任何幫助將非常感激! 謝謝!

您可以使用此:

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

但是我強烈建議您找到一種方法來更改腳本中的圖像路徑,而不要使用htaccess。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM