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

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

问题描述

下面就是我想要做的事情。

Here's what I'm trying to do.

当你键入 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天全站免登陆