2014-01-18 190 views
0

我倒是喜歡重定向與名稱的所有圖像結束( 「-554-380」):
子域稱爲:http://static.domain.de重定向到子域夾

http://domain.de/../..-554-380 - 重定向 - >http://static.domain.de/images/..-554-380

我的根.htaccess文件看起來像:

RewriteCond %{HTTP_COOKIE} HTTP_IS_HIDPI 
RewriteCond %{DOCUMENT_ROOT}/$1-554x380.$2 -f 
RewriteRule ^(static/images.+)-277x190\.(jpe?g|png)$ $1-554x380.$2 [NC,L] 

感謝您的幫助
Ogni

回答

0

讓你的規則是這樣的:

RewriteCond %{HTTP_HOST} ^(www\.)?domain\.de$ [NC] 
RewriteRule ^(.+?-554-380)$ http://static.domain.de/images/$1 [L,NE,R=301] 

RewriteCond %{HTTP_COOKIE} HTTP_IS_HIDPI 
RewriteCond %{DOCUMENT_ROOT}/$1-554x380.$2 -f 
RewriteRule ^(static/images.+)-277x190\.(jpe?g|png)$ $1-554x380.$2 [NC,L] 

UPDATE:每作爲評論:

RewriteCond %{HTTP_HOST} ^static\.domain\.de$ [NC] 
RewriteRule ^(.+?)-277x190\.(jpe?g|png)$ /$1-554x380.$2 [NC,L] [L,NC,NE] 
+0

感謝。我只是偶然的這個規則,與子域的正確部分或?但我不知道這個語法。 'RewriteRule ^(static/images。+) - 277x190 \。(jpe?g | png)$ $ 1-554x380。$ 2 [NC,L]' – ogni

+0

對不起,我不知道'這個規則,與子域的右側部分或?'你能澄清你的問題嗎? – anubhava

+0

我不能「翻譯」'RewriteRule ^(http://static.domain.de/images.+)-277x190 \ ..'intro .htaccess兼容語法。 – ogni