将目录重写到域 [英] Rewrite a directory to domain

查看:91
本文介绍了将目录重写到域的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在努力进行.htaccess重写,有人可以指出正确的方向吗?

I'm struggling with an .htaccess rewrite, can anyone point me in the right direction please?

我希望能够将所有请求重写为

I want to be able to rewrite all requests to

www.domain.com/images到images.domain.com(子域位于其他服务器上),保持文件名和子文件夹请求不变。

www.domain.com/images to images.domain.com (the subdomain is on a different server), keeping any filename and sub-folder requests intact.

因此,对www.domain.com/images/folder1/image1.jpg的请求将从images.domain.com/folder1/image1.jpg中获取图像

So requests to www.domain.com/images/folder1/image1.jpg will get the image from images.domain.com/folder1/image1.jpg

谢谢。

推荐答案

使用此规则:

RewriteEngine on
RewriteRule ^images/(.*)$ http://images.domain.com/$1 [L,R=301]

这篇关于将目录重写到域的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆