如何在子域中安装 WordPress?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/21743656/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 19:28:56  来源:igfitidea点击:

How to install WordPress in subdomain?

wordpresssubdomain

提问by Aron

At the moment I have a WordPress installation in a subfolder of my current site (example.com/wordpress). How do I make it so that wordpress is accessible from a subdomain?

目前,我在当前站点 ( example.com/wordpress)的子文件夹中安装了 WordPress 。如何使 wordpress 可以从子域访问?

I.e. I would like wordpress to be accessible from this address: wordpress.example.com, and that all the links, posts and pages will still work flawlessly, e.g. wordpress.example.com/my-wp-post/

即我希望可以从此地址访问 wordpress: wordpress.example.com,并且所有链接、帖子和页面仍然可以正常工作,例如wordpress.example.com/my-wp-post/

If it makes a difference which host one is with, I am asking specifically about 1&1.

如果与哪个主机在一起有所不同,我会专门询问 1&1。

Thank you

谢谢

回答by Eric Laoshi

I am not a big fan of video tutorials, but I used this oneto successfully set up a new subdomain and install wordpress.

我不是视频教程的忠实粉丝,但我使用这个成功设置了一个新的子域并安装了 wordpress。

Here is an overview of the process

这是该过程的概述

  1. Use cpanel to create the subdomain
  2. Download the latest version of wordpress to your local drive
  3. Upload to subdomain folder on your host
  4. Extract the files, and move them into the subdomain folder
  5. Use cpanel SQL Wizard to create a new data base
  6. Make a note of the username, db name and db password
  7. Copy wp-config-sample.php to wp-config.php in the subdomain folder
  8. Edit wp-config.php to add the username, db name and db password
  9. Open the URL "your-subdomain.your-domain.com/wp-admin/install.php"
  10. Fill out the fields on the form and press "install wordpress"
  1. 使用 cpanel 创建子域
  2. 将最新版本的 wordpress 下载到您的本地驱动器
  3. 上传到主机上的子域文件夹
  4. 提取文件,并将它们移动到子域文件夹中
  5. 使用 cpanel SQL Wizard 创建新数据库
  6. 记下用户名、数据库名称和数据库密码
  7. 将 wp-config-sample.php 复制到子域文件夹中的 wp-config.php
  8. 编辑 wp-config.php 以添加用户名、数据库名称和数据库密码
  9. 打开 URL“your-subdomain.your-domain.com/wp-admin/install.php”
  10. 填写表单上的字段,然后按“安装 wordpress”

After creating the a subdomain I use WP cloneto create and install a backup of my live site into the new subdomain. The clone site allows me to verify updates before deploying them my public site.

创建子域后,我使用WP clone创建并将我的实时站点的备份安装到新的子域中。克隆站点允许我在将它们部署到我的公共站点之前验证更新。

Hopefully the OP has resolved this issue, but maybe this will be of use to others.

希望 OP 已经解决了这个问题,但也许这对其他人有用。

回答by Adam Erstelle

I think you have 2 options.

我认为你有 2 个选择。

1) Manually:

1)手动:

Copy your wordpress install from the subfolder of your main domain to the subdomain's folder. Using a database editing tool (of your choice) go into the wp_options table and change the option_value of the option_name 'siteurl' and 'home'.

将您的 wordpress 安装从主域的子文件夹复制到子域的文件夹。使用数据库编辑工具(您选择的)进入 wp_options 表并更改 option_name 'siteurl' 和 'home' 的 option_value。

You might have a few other options that will need editing, but they are more often than not plugin specific.

您可能还有一些其他选项需要编辑,但它们通常不是特定于插件的。

2) A little better:

2)好一点:

Create a new wordpress install in your subdomain. Copy your plugins, themes and uploads into it. Then, install the plugin wp-migrate-db-pro from https://deliciousbrains.com/wp-migrate-db-pro/Use this plugin to copy the database from the subfolder install to the subdomain install. This plugin will globally search and replace the URLs and Folders for you.

在您的子域中创建一个新的 wordpress 安装。将您的插件、主题和上传内容复制到其中。然后,从https://deliciousbrains.com/wp-migrate-db-pro/安装插件 wp-migrate-db-pro使用此插件将数据库从子文件夹安装复制到子域安装。此插件将为您全局搜索和替换 URL 和文件夹。

I've been using this plugin for a while...and it saves me hours and hours of work.

我一直在使用这个插件一段时间......它为我节省了几个小时的工作。

回答by doc holiday

Purchase your unique URL or subdomain or wherever you want the wordpress to live from your host provider.

从您的主机提供商处购买您唯一的 URL 或子域或您希望 wordpress 存在的任何地方。

wordpress.example.com

coolurl.cooltimes.com

upload Wordpress to that root. /

将 Wordpress 上传到该根目录。 /

Or define a custom folder for it;

或者为它定义一个自定义文件夹;

wordpress.example.com/partywp/

NOTE: If your looking for the free (no hosting required - though less custom website friendly)wordpress with similar URL, please use wordpress.com version and you don't need to do anything.

注意:如果您正在寻找具有类似 URL的免费(无需托管 - 尽管对自定义网站不友好)wordpress,请使用 wordpress.com 版本,您无需执行任何操作。

http://wordpress.com/is different from http://wordpress.org/

http://wordpress.com/http://wordpress.org/不同

Wordpress.com is like google blogger and you simply create an account and they give you a URL - and free blogging area with small templates. You can transfer your free wordpress.com to custom wordpress.org -- if you would like to use wordpress hosting naming convention, consult wordpress.

Wordpress.com 就像谷歌博主,您只需创建一个帐户,他们就会为您提供一个 URL - 以及带有小模板的免费博客区。您可以将您的免费 wordpress.com 转移到自定义 wordpress.org - 如果您想使用 wordpress 托管命名约定,请咨询 wordpress。

Added:

添加:

If you are changing the location from your original install; to a different path or location. You should then uninstall the Wordpress that is elsewhere or previous, and reinstall at where you want it to currently live to avoid any wholes or errors, etc.

如果您要更改原始安装的位置;到不同的路径或位置。然后,您应该卸载其他地方或以前的 Wordpress,并在您希望它当前所在的位置重新安装,以避免任何整体或错误等。

So, if now it must be at: wordpress.example.com-- work with your host provider (hopefully not godaddy) locate the root to this domain, and reinstall with a fresh latest version and you should be OK. If you have further DNS issues, please try to describe your question more clearly.

所以,如果现在它必须在:wordpress.example.com- 与您的主机提供商合作(希望不是godaddy)找到该域的根目录,并使用最新版本重新安装,您应该没问题。如果您还有其他 DNS 问题,请尝试更清楚地描述您的问题。