使用 cpanel 将用户重定向到新的子域,并在用户浏览器上保留原始 URL

发布于 2024-07-20 23:53:22 字数 469 浏览 2 评论 0原文

我在我的提供商处有一个 php 帐户,并且还为我安装了 cpanel。

我目前在那里有两个 Drupal 站点,我们将其称为主站点 myMainSite,另一个正在建设中的站点称为 myNewSite。

因此,当我访问 www.myMainSite.com 时,我会访问主站点。 当我访问 myNewSite.myMainSite.com 时,我会访问正在建设中的 drupal 站点。

我的问题是,当我正在建设的网站上线时,我希望所有访问 www.myMainSite.com 的用户都能看到新网站(位于 myNewSite.myMainSite.com 下的网站) )。

我怎样才能用 cpanel 完成这个任务? 它在“附加域”配置中吗? 我不想要更改地址栏的重定向,即我想保留原始网址。

I have a php account with my provider, and I also have cpanel installed for me.

I currently have two drupal sites there, let's called the main myMainSite and another one under construction called myNewSite.

So when I go to www.myMainSite.com, I go to the main site. When I go to myNewSite.myMainSite.com, i go to the drupal site that is under construction.

My question is, when my under construction site goes live, I want that all users that go to www.myMainSite.com see the new site (the one that is under myNewSite.myMainSite.com).

How can I accomplish this with cpanel? is it within the "addon domains" configuration?
I don't want a redirect that changes the address bar, ie, I want to keep the original url.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

冷默言语 2024-07-27 23:53:22

您只需将 www.mainsite.com 的 DocumentRoot 更改为指向与 myNewSite.myMainSite.com 相同的 DocumentRoot。

You would just change the DocumentRoot of www.mainsite.com to point to the same DocumentRoot as myNewSite.myMainSite.com.

似最初 2024-07-27 23:53:22

我假设您已使用 cPanel 的子域控制面板添加 myNewSite.myMainSite.com。 我假设 myMainSite.com 位于 /public_html/ 文件夹中。 因此,新站点(以及具有子域的站点)将位于 /public_html/myNewSite.myMainSite.com

为什么您不能仅使用文件管理器(或 FTP)来移动 中的所有文件>/public_html//public_html/OLDsite

然后将 /public_html/myNewSite.myMainSite 中的所有内容移至 /public_html/ 文件夹中。

然后检查您的网站是否正在使用新文件。

也许您还可以向您的主机发送支持票,看看是否还有其他方法。 这可能就像他们更改 Apache 的 conf 文件中的 myNewSite.myMainSite.com 子域一样简单。

我还认为您需要更改 Drupal 中的设置(当您更改域名时),以便 Drupal 也知道新域名。

I assume you've used cPanel's subdomain control panel to add myNewSite.myMainSite.com. And I'll assume myMainSite.com is in the /public_html/ folder. Therefore the new site (and site with a subdomain) will be at /public_html/myNewSite.myMainSite.com

Why can't you just use File Manager (or FTP) to move all the files in /public_html/ to /public_html/OLDsite?

Then move everything from /public_html/myNewSite.myMainSite into the /public_html/ folder.

Then check your site is working with the new files.

Maybe you could also send a support ticket to your host to see if there's another way. It could be as simple as them changing something in Apache's conf file for the myNewSite.myMainSite.com subdomain.

I'd also think you'd need to change the settings in Drupal (when you've changed domain) so Drupal knows the new domain name too.

白芷 2024-07-27 23:53:22

我建议您有 2 个主要用户帐户分别称为 oldlive 和 newlive。

您可能拥有像

oldlive.myMainSite.com 和 newlive.myMainSite.com

这样的域名,那么当您还没有准备好时,您可以将 Park 域名 myMainSite.com 添加到 oldlive.myMainSite.com 中。

一旦您完成了当前位于 newlive.myMainSite.com 的新站点,您将从 oldlive.myMainSite.com 中删除公园域并移至 newlive.myMainSite.com。

然后就可以顺利转移域名了。

I recommend you to have main 2 user accounts call oldlive and newlive.

you may have domain like

oldlive.myMainSite.com and newlive.myMainSite.com

Then you can add Park Domain myMainSite.com to oldlive.myMainSite.com when you not ready.

Once you are completed new site which currently in newlive.myMainSite.com, you will remove park domain from oldlive.myMainSite.com and move to newlive.myMainSite.com.

then you can transfer domain smoothly.

浮华 2024-07-27 23:53:22

您可以使用 cPanel 中的“重定向”选项将所有访问者从旧站点重定向到新站点。
或者您可以简单地将主域的 Apache 中的 Virtualhost 更改为已完成的目录(当前正在建设站点)。

You can use "Redirects" option in cPanel to redirect all visitors from old to new site.
Or you can simply change Virtualhost in Apache for your main domain to directory of your finished (currently under construction site).

爱*していゐ 2024-07-27 23:53:22

同意之前的回答。 如果您想在主站点上加载子域的内容,则需要将数据从子域的目录移动到根目录 public_html。

只要确保您的主域上没有任何实时站点,如果您的主域有工作站点并且您将在根目录下上传内容,那么您的网站将因内容冲突而无法工作。

如果不可能,那么您需要将内容上传到 public_html 的一个子目录下,然后您可以通过您的 P_website_name/目录名称访问该网站。

完成移动内容后,您将需要将基本 UR L 更新为新站点 URL。它出现在 cPanel >> 中 文件管理器>> public_html>> 站点/默认/Settings.php

Agree with the previous answer. If you would like to load the sub-domain's contents on the main site then you will need to move the data from sub-domain's directory to root directory that is public_html.

Just make sure, you do not have any live site on your main domain, If your main domain has the working site for it and you will upload the contents under the root directory then your website won't work due to conflict in contents.

If it's not possible then you will need to upload the contents under one sub-directory in public_html and after that you can access the site by yourP_website_name/directory name.

Once you will done with the moving contents then you will need to update the base UR Lto the new site URL.It is present in cPanel >> File Manager >> public_html >> Sites/Default/Settings.php

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文