Redirect subdomain into top-level domain's folder

一个人想着一个人 提交于 2019-11-30 05:50:49

问题


Here's what I'm trying to do.

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.


回答1:


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]



回答2:


Just set the subdomain's root dir to example.com/m/. Then there is no redirection.



来源:https://stackoverflow.com/questions/1456956/redirect-subdomain-into-top-level-domains-folder

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!