简体   繁体   English

从域根文件夹重定向到子域文件夹

[英]Redirect from domain root folder to subdomain folder

I´d like to redirect all images with name ending ("-554-380"): 我想重定向所有名称以(-554-380)结尾的图像:
Subdomain called: http://static.domain.de 子域称为: http : //static.domain.de

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

My root .htaccess file looks like: 我的根.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]

Thanks for your help 谢谢你的帮助
Ogni 奥格尼

Have your rules like this: 有这样的规则:

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: As per comments: 更新:根据评论:

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM