重定向到另一个域中一个子不改变它的URL [英] Redirecting to a subdomain from another domain without changing its URL
问题描述
我有一个项目,用户可以创建自己的配置文件。而配置文件将有子域网址如 robert.blogger.com
。因此,如果用户有他自己的一些领域如 robert.com
。
然后,我希望每个请求 robert.com
来重定向到 robert.blogger.com
不改变网址。
I have a project where users can create their own profiles. And the profiles will have sub-domain URLs like robert.blogger.com
. So if that user has some domain of his own like robert.com
.
Then I want every request for robert.com
to redirect to robert.blogger.com
without changing the URL.
该URL应显示 robert.com/home.html
, robert.com/aboutus.html
等。但实际上code应该从 robert.blogger.com/index.html
, robert.com/aboutus.html $ C运行$ C>等。
The URL should show robert.com/home.html
, robert.com/aboutus.html
etc. but actually code should be run from robert.blogger.com/index.html
, robert.com/aboutus.html
etc.
这可能吗?如果是这样,这可怎么办呢?
Is this possible? If so, how can this be done?
推荐答案
这将工作
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} !^www\.domainname.com
RewriteCond %{HTTP_HOST} ([^.]+)\.domainname.com
RewriteRule ^(.*) user/user.php?username=%1
ErrorDocument 404 /notfound.php
IndexIgnore .htaccess */.??* *~ *# */HEADER* */README* */_vti*
这篇关于重定向到另一个域中一个子不改变它的URL的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!