htaccess如何在不更改url的情况下将所有网站页面运行到子域


htaccess how to run all site pages to subdomain without changing the url

我想重定向一个网站,但不更改地址栏中的URL
类似:URL是:m.example.com,但这里应该运行example.comexample.com的所有页面都应该在这里运行。

例如
m.example.com/about -> example.com/about
但地址栏中的URL必须是m.example.com

是的,这可以通过一些简单的.htaccess规则来实现:

RewriteEngine On
RewriteCond %{HTTP_HOST} !^m'.
RewriteRule ^(.*)$ http://m.%{HTTP_HOST}/$1 [R=301,L]

你们也可以阅读这篇关于这个主题的伟大文章。