我正在尝试将该URL customer1.example.com重写为http://example.com/customer1。使用此代码,一切正常。
RewriteCond %{HTTP_HOST} ^(.+)\.example\.com$ [NC]
RewriteCond %{HTTP_HOST} !www.example.com$ [NC]
RewriteRule ^(.*)$ http://example.com/%1/$1 [L,R=301]
但是如果根目录目录中不存在
另一个我认为我需要的是,重写仅覆盖example.com,而不能覆盖服务器上的其他域。
谢谢您的帮助我正在尝试将此URL customer1.example.com重写为http://example.com/customer1。使用此代码,一切正常。 RewriteCond%{HTTP_HOST} ^(。+)\。example \ .com $ [NC] RewriteCond%{HTTP_HOST}!www ....