如何使用apache模式_重写规则重定向到动态URL(不是经典的重定向)?
我想使用apache mod_重写规则重定向到动态URL,而不更改URL本身 动态URL:www.example.com/business/carwash 在上面的url中,“carwash”部分是一个用户名,用于查找特定的业务。 我想要这样的URL:carwash.example.com 要重定向以显示此URL的内容:www.example.com/business/carwash 不更改URL(URL仍为carwash.example.com) 我尝试了以下代码: 重写cond%{HTTP_HOST}^carwash.cityrakhsh.com 重写规则^(.*)[P] 但它不起作用。 我怎么做?如何使用apache模式_重写规则重定向到动态URL(不是经典的重定向)?,apache,redirect,mod-rewrite,url-rewriting,httpd.conf,Apache,Redirect,Mod Rewrite,Url Rewriting,Httpd.conf,我想使用apache mod_重写规则重定向到动态URL,而不更改URL本身 动态URL:www.example.com/business/carwash 在上面的url中,“carwash”部分是一个用户名,用于查找特定的业务。 我想要这样的URL:carwash.example.com 要重定向以显示此URL的内容:www.example.com/business/carwash 不更改URL(URL仍为carwash.example.com) 我尝试了以下代码: 重写cond%{HTTP_
提前感谢。子域(在本例中为carwash)可在重写规则中使用%1替换
RewriteCond %{HTTP_HOST} ^(.*).cityrakhsh.com$
RewriteRule ^(.*) "http://cityrakhsh.com/business/%1/" [P]
在这种情况下,可以使用%1在重写规则中替换子域
RewriteCond %{HTTP_HOST} ^(.*).cityrakhsh.com$
RewriteRule ^(.*) "http://cityrakhsh.com/business/%1/" [P]