简体   繁体   English

使用htaccess将通配符子域映射到其他主机

[英]Mapping wildcard subdomain to other host using htaccess

I host my wordpress on appfog but appfog doesn't allow wildcard subdomain yet. 我将我的wordpress托管在appfog上,但appfog尚不允许通配符子域。 I decided to create an app on heroku and place the htaccess there, so any wildcard subdomain will rewrite to appfog. 我决定在heroku上创建一个应用程序并将htaccess放在此处,因此任何通配符子域都将重写为appfog。

How to make the URL sample-post.apps1.herokuapp.com/subtitle/... --> apps1.appfog.com/sample-post/subtitle/... using htaccess placed on heroku cedar? 如何使用放在Heroku Cedar上的htaccess来制作URL sample-post.apps1.herokuapp.com/subtitle / ...-> apps1.appfog.com/sample-post/subtitle / ...?

Try: 尝试:

RewriteEngine On
RewriteCond %{HTTP_HOST} ^([^.]+)\.apps1\.herokuapp\.com$ [NC]
RewriteRule ^(.*)$ http://apps1.appfog.com/%1/$1 [L,R]

If you don't want the URL in the browser's address bar to change (via the redirect, R flag in square brackets), then try changing the R to P (proxy). 如果您不想更改浏览器地址栏中的URL(通过重定向,方括号中的R标志),请尝试将R更改为P (代理)。 Apache would need to have mod_proxy loaded. Apache将需要加载mod_proxy。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM