簡體   English   中英

使用htaccess重定向圖像文件夾

[英]Redirect images folder using htaccess

使用移動設備/平板電腦時,我試圖將圖像文件夾(特別是jpg文件)重定向到其他位置。 這是我目前所擁有的,但是在查看圖像時,它會不斷顯示500 Internal Server Error。

RewriteCond %{HTTP_USER_AGENT} iphone|ipad|ipod|android|blackberry [NC]
RewriteRule ^images/(.+)\.(jpg)$ http://www.domain.co.uk/images/mobile/$1.$2 [QSA,L]

謝謝

由於循環,您遇到了錯誤。 試試下面的代碼:

RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$ [NC] 
RewriteCond %{REQUEST_URI} !/images/ [NC]
RewriteRule \.(png|gif|jpe?g)$ images%{REQUEST_URI} [L,NC]

僅當/ images /在URI中不存在時,才會重寫圖像URL。

暫無
暫無

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

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