使用 .htaccess 规则进行特定于域的文件夹重定向?
我最近将我的网站(Drupal 安装)上的 files/images 文件夹从 /sites/default/files/ 移动到 /sites/example.com/files/,但现在有很多来自外部热链接源的 301 错误,并且我想将入站链接从旧的“默认”路径重定向到新的“example”。 com' 路径,但仅针对这一域...
基本上,我想将访问者从以下位置重定向:
example dot com /sites/default/files/*
到:
example dot com / site/example.com/files/*
同时允许来自其他域(例如 example2.com)的访问者仍然可以看到sites/default/files。
(抱歉,对于所有奇怪的 .com 和间距,我最多只允许发布一个“超链接” - 也许 Stack Overflow 应该考虑允许示例 .com 根据需要多次使用)。
I recently moved a files/images folder on my site (a Drupal installation) from /sites/default/files/ to /sites/example.com/files/, but there are now a lot of 301 errors from external hotlinking sources, and I'd like to redirect inbound links from the old 'default' path to the new 'example . com' path, but only for this one domain...
Basically, I'd like to redirect visitors from the following:
example dot com /sites/default/files/*
to:
example dot com /sites/example.com/files/*
While allowing visitors from other domains (e.g. example2 dot com) to still see sites/default/files.
(Sorry for all the weird dot com and spacing, I'm only allowed to post a maximum of one 'hyperlink' - perhaps Stack Overflow should consider allowing example dot com as many times as needed).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试这个 mod_rewrite 规则:
Try this mod_rewrite rule: