I have a site www.domain with Wordpress installed. I need to create a subdomain for testing a new theme and have it linked to the main site's database. I have manually added the Wordpress files into the subdomain and during the install in the browser I added the database info of the main site. However when I then try to complete the installation it tells me that I already have Wordpress installed and directs me to log into the main site. When I do so there is no option to view the subdomain.
How do I link the subdomain to the main site's database and have them work independently?
I have a site www.domain with Wordpress installed. I need to create a subdomain for testing a new theme and have it linked to the main site's database. I have manually added the Wordpress files into the subdomain and during the install in the browser I added the database info of the main site. However when I then try to complete the installation it tells me that I already have Wordpress installed and directs me to log into the main site. When I do so there is no option to view the subdomain.
How do I link the subdomain to the main site's database and have them work independently?
Share Improve this question asked Mar 30, 2019 at 2:07 NiallNiall 271 silver badge5 bronze badges 03 Answers
Reset to default 0Change the $table_prefix
in the wp-config.php
file.
But if you use the same database prefix on both sites, won't theme/plugin changes on the 2nd domain affect the first domain, since both are using the same database? (Theme and plugin settings are usually stored in the wp-options table of the database.)
I would set up a separate install of WP, then export from the 1st site to the 2nd site. That will give you content you can use as you play with themes and plugins. Once you get the themes and plugins working, you can export those (via an export/import plugin) from the 2nd site to the 1st site to get the theme/plugin settings into the 1st site.
If you just need to play with theme settings on the 2nd site, then there are some theme export/import plugins that work well to move the theme settings.
Don't do that. Let your testing site have its own database where you import a dump of your live site's database. Every environment is always supposed to have their own databases. If not, changes on the testing site would either affect the live site and/or raise the risk of FUBAR'ing your live site.
Consider Installing WordPress on your own Computer for that. Then download your live site's upload folder, plugins, themes and your lives site's database, and import your live site's database into the database on your own computer.
Then you can gamble around whatever you want. And if something's wrong, you can simply drop the database and import the live dump again.
Note that when importing your live database locally, you need to tell WordPress it got moved to another URL. So you simply could place the following three lines in your local wp-config.php
. Where you replace http://mylocalurl.tld
with the actual URL you access the local site on your computer.
define('RELOCATE', TRUE);
define('WP_HOME', 'http://mylocalurl.tld');
define('WP_SITEURL', 'http://mylocalurl.tld');
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745644526a4637890.html
评论列表(0条)