本文介绍了重定向文件夹,子站点文件夹的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
文件夹中的每一个形象
http://www.example.com/files/thumbs
需要重定向到
http://images.example.com/files/thumbs
我想:
重写规则^文件/拇指(。*)$ http://images.example.com/$1 [L,R = 301]
但结果是:
http://images.example.com//test.jpg
而不是
http://images.example.com/files/thumbs/test.jpg
谢谢
解决方案
您需要捕获完整的请求网址:
的RewriteCond%{HTTP_HOST} ^(?:WWW \)?例如\ .COM $ [NC]
重写规则^(文/大拇指/.*)$ http://images.example.com/$1 [L,R = 301,NC]
Every image in the folder
http://www.example.com/files/thumbs
needs a redirect to
http://images.example.com/files/thumbs
I tried:
RewriteRule ^files/thumbs(.*)$ http://images.example.com/$1 [L,R=301]
but result is:
http://images.example.com//test.jpg
instead of
http://images.example.com/files/thumbs/test.jpg
thank you
解决方案
You need to capture full request URL:
RewriteCond %{HTTP_HOST} ^(?:www\.)?example\.com$ [NC]
RewriteRule ^(files/thumbs/.*)$ http://images.example.com/$1 [L,R=301,NC]
这篇关于重定向文件夹,子站点文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!