重定向到另一个域中一个子不改变它的URL它的、个子、不改变、重定向

2023-09-02 01:06:42 作者:怀念原属于我的温柔ゝ

我有一个项目,用户可以创建自己的配置文件。而配置文件将有子域网址如 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 等。

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*