简体   繁体   English

WordPress-促进开发构建到生产

[英]WordPress - Promoting A Dev Build To Production

I recently took over a WordPress site with the following directory structure inside of /public_html : 我最近在/ public_html中接管了具有以下目录结构的WordPress网站:

wp_config.php
/wp-admin
/wp-content
/wp-includes
...
...
...
/development 

The root (production) site is pointed to /public_html . 根(生产)站点指向/ public_html Inside of /public_html , I have a sub-folder called /development . / public_html内部,我有一个子文件夹/ development This subfolder has its own separate installation of Wordpress with a directory tree that looks like: 此子文件夹具有自己的单独的Wordpress安装,其目录树如下所示:

wp_config.php
/wp-admin
/wp-content
/wp-includes
...
...
...

You can access this WordPress instance via www.mywebsite.com/development . 您可以通过www.mywebsite.com/development访问此WordPress实例。 I am at a point where I would like to promote the development build to production. 我现在想将开发构建推向生产。

What's the "WordPress" way of doing this? 这样做的“ WordPress”方式是什么? This is hosted on a machine that can be accessed via cPanel. 它托管在可以通过cPanel访问的计算机上。 I've noticed that while you can add "Addon Domains" and "Subdomains" via cPanel, you can't change the root public directory through cPanel. 我注意到,尽管您可以通过cPanel添加“附加域”和“子域”,但不能通过cPanel更改根公共目录。 I would like to avoid SSHing into the machine and manually editing the httpd.conf file since that can cause conflicts with cPanel. 我想避免SSH进入计算机并手动编辑httpd.conf文件,因为这可能导致与cPanel发生冲突。

Is there a functionality in either cPanel or WordPress to automatically take what's in /public_html/development and replace /public_html with its contents? cPanel或WordPress中是否有功能可以自动获取/ public_html / development中的内容并将其内容替换为/ public_html

I ended up taking the .htaccess and index.php files from /public_html/development and using them to replace the same files in /public_html . 我最终从/ public_html / development中获取.htaccessindex.php文件,并使用它们替换/ public_html中的相同文件。

Once you replace the two files, open up index.php (inside of /public_html ) and update 替换两个文件后,打开index.php (在/ public_html内 )并更新

require( dirname( __FILE__ ) . '/wp-blog-header.php' );

to

require( dirname( __FILE__ ) . '/development/wp-blog-header.php' );

with development being the name of the subdirectory you got your index.php and .htaccess files from. development作为子目录的名称,您从中获得了index.php.htaccess文件。

After you replace the above two files, go to your WP Admin console associated with the build you would like to promote to production and then click on "Settings" -> "General". 替换上述两个文件后,转到与要升级到生产环境的版本关联的WP管理控制台,然后单击“设置”->“常规”。 Find the Site Address (URL) input and update the value from https://www.mywebsite.com/development to https://www.mywebsite.com . 查找站点地址(URL)输入,并将值从https://www.mywebsite.com/development更新为https://www.mywebsite.com

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

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