将子域重定向到顶级域的文件夹 [英] Redirect subdomain into top-level domain's folder

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

问题描述

这就是我想要做的.

当您输入 m.example.com 时,我希望用户被重定向到 example.com/m/,但我希望保留地址栏中的 url如果可能,m.example.com.

When you type m.example.com I want users to be redirected to example.com/m/ but I would like the url in the address bar to remain m.example.com if possible.

推荐答案

你可以用 mod_rewrite 和 mod_proxy 做到这一点:

You can do that with mod_rewrite and mod_proxy:

RewriteEngine on
RewriteCond %{HTTP_HOST} ^m.example.com$
RewriteRule ^ http://example.com/m%{REQUEST_URI} [L,P]

这篇关于将子域重定向到顶级域的文件夹的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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