how to switch domain of two wordpress site with each other - wordpress

I have two wordpress site on same server with different domain name.
here is first one
here is the second one
My client is saying that he want to switch the domain name for both site with each other that is first domain will work on second one and second on the first one.
how to do this any idea or help will be appreciated.
Thanks

The free way:
Download each site to separate folders on your hard drive.
Make a database backup of each site with phpmyadmin
Delete both websites via ftp
Clear out both databases
Upload site 1 to site 2's former location and vice versa.
Load up phpmyadmin and restore database 1 to database 2 and vice versa.
In each database, open up the wp_options table and change siteurl and home to reflect the new domain name
Using phpmyadmin's search function, search for the old url in all tables, and manually update them if necessary.
The paid way:
Use ManageWP or BackupBuddy to assist in automating the above. With either tool you can make a full backup and then restore to a different server, and they automate the domain name change.

Related

Wordpress wants to install itself, rather than run the blog

We have created a duplicate of our website on a new server as part of a migration. We have a wordpress blog that is part of our website.
The docroot of the wordpress site is set as an alias in our main site. The result is that to access the site home page, the following url is used: https://www.rephunter.net/blog/.
The new environment is not available to the public at this time, and is only accessible within our VPN. When the above link to the blog is followed, instead of the expected home page of our blog, we get the page at https://www.rephunter.net/blog/wp-admin/install.php, which wants to install a new site.
The configuration in the new environment is supposedly an exact copy of our production site from some time back. The permissions on the main files is the same.
What is it that is causing the attempted blog access to be redirected to the installation script?
EDIT:
The responses so far have not really absorbed the intent of the previous information. We are not migrating in the normal sense. Rather we are testing in a new virtual environment that will eventually lead to a more normal migration.
We have an exact duplicate of our original wordpress and database environment that is running in a virtual environment with an updated protocol stack that is only accessible if you are on the VPN for that environment. As far as we can tell, there is no difference in the configuration.
For example, the parameters in wp-config.php are exactly the same as in the original installation. When php runs, it sees the same environment, with host names and everything identical. It would not work otherwise.
Yet if there really were no difference, it would just run. But since WP is trying to install a new database, there is something different that we are missing.
To further illustrate this: supposed you took an image backup of the wordpress installation and the database, and put it in a different VM, and set up the DNS and everything as it needs to be--the new environment looks no different than the old one. All databases, wp-config settings, etc, are the same. So our main website and database functions very similarly.
As I mentioned above, the difference in the protocol stack should be considered. The old system is on PHP 5.6.27--the new one is on 7.3.4. So that could be causing some difference, which maybe somebody might recognize. Wordpress is 5.2.2 and should be compatible with both PHP levels.
We believe there is some relatively simple parameter setting that we are missing. For example, as in the first answer that $table_prefix is set wrongly. But that is not it in this case.
WordPress redirects you to that installation screen because the database it's connecting to is working (meaning, the username and password are correct), but the data it's expecting to be there isn't. Therefore, it assumes it's a new / empty database and prompts you to install WordPress.
I've seen this happen in two scenarios:
The database really is empty, and thus WP needs to install the standard tables and info
The table prefix in your wp-config.php file is incorrect for an existing database
Look at your wp-config.php file in the root directory of WordPress, and look for a line similar to this:
$table_prefix = 'wp_';
Then, open up the database (phpMyAdmin or some other interface to browse what the database structure actually is) and confirm that the table prefixes (the first few characters of the table names) actually match what's set above.
Hopefully this gives you something to go on! Let us know what you find
Migrating Wordpress websites can be quite tricky. I've worked as a WP developer for a number of years and always struggled with manually migrating websites.
There are a number of factors to consider:
WP stores a lot of installation specific information within the database. So you can't do a database dump and upload the export into a new database.
Changing the website url within the wp_options table in the databased there are still other references to the original url scattered throughout the db.
You could try a find and replace all using an editor that supports this sort of functionality (vscode, sublime, atom) but things always end up breaking and your doing tons of "find & replace" actions.
I have always relied on a 3rd party tool Backup Buddy as it simplifies the entire backup and migration process and offers the peace of mind of having easily deployable backups for your website.
Backup Buddy allows you to export your website as a zip and then you can move the zip to any server you want and the plugin provides an installer script (php) to guide you through the migration of your wp site to any host and database of your choosing.
Note: I am not in any way affiliated with iThemes or Backup buddy, and I do not stand to benefit in anyway if you decide to use the plugin. This is only advice on a tool that I have found helpful, reliable, have had success with, and currently actively use on a number of websites that I maintain.
WordPress display installation page because you have not update your wp-config.php file after migrating server so please follow below steps in future when you migrate your website.
Please follow this steps when you migrate your WordPress website from one server to another server.
Back up your website files/database
Export wordpress database.
Create database on your new host server.
Edit the wp-config.php File and edit this details.
Add new database name
Add new database username
Add new database user Password
Add new host as per your hosting provider or (localhost is default)
Import your database to new server.
upload the WordPress files to your new host
defining new domain URL & Search/Replace old domain URL

How to change the domain only without migrating the files

I have two business domains, for example, domain.com and dev.domain.com.
Since I had to keep the old website for running the business while developing website, I keep the old website to domain.com and bought the new theme, installed, and developed in dev.domain.com.
After finished the development, I wanted to use the domain.com instead of dev.domain.com, but when I migrate all the file, all the plug-ins were not working because of license reason.
Since I don't want to develop entire website again, I just made domain.com to forwarding to dev.domain.com.
Is there way I can change domain to domain.com?
Thanks,
Not entirely sure but you're probably getting errors because WordPress saves the site URL in the database so after you move the files to domain.com, the database is still requesting stuff from dev.domain.com. Changing the one table in the database (site_url under wp_options) is sometimes enough but if you've been developing a site I'm guessing you've got a bunch of links and images set up with the dev.domain.com URL. What I usually do when migrating a dev site to live is...
Set up a new Database and User/Pass for the new live site.
Export the database from the dev site.
Open the database in Notepad++
Use Find and Replace (ctr+h) to find dev.domain.com and replace with
domain.com, choosing Replace All.
Now import this database to the new database you set up earlier, and
change the wp-config.php database settings to the new database.
Be sure to keep copies of the backup before you edit the database in case anything goes wrong, but you should be good. This is how I do it all the time.
https://codex.wordpress.org/Moving_WordPress#If_You_Have_Accidentally_Changed_your_WordPress_Site_URL.
This https://interconnectit.com/products/search-and-replace-for-wordpress-databases/ is probably a better method than trying to load your entire db into a single text file is not the most viable option.

What step have i missed? Transferring wordpress site

So i have recently tried to transfer my wordpress site to another server.
I have followed a few guides, but i definately seem to be missing a step.
Basically what i have done is:
export original database (phpMyAdmin)
Save all relevant files (ftp)
install fresh wordpress on new server. (wp backend)
'drop' all table fields in new wordpress (phpMyAdmin)
import original database to new location (phpMyAdmin)
transfer theme, plugins, uploads. (ftp)
activate theme, plugins. (wp backend)
update permalinks. (wp backend)
The problem is, i am left with a default looking wordpress installation, and not my orginal page-home.php and corresponding css.
Also, if i go to wordpress backend SETTINGS > READING > Frontpage:static; i only have the option of 'about', not home, i should have 'home'...
Sorry if i am vague, let me know if any screenshots are required.
We really need a little more info like:
when you say plain, do you mean just the theme is not set and you're on the default theme, or there is no theme, or do you mean even your content is not there?
the site you removed it from, where was the installation located? Was is in the public_html folder or a subfolder of that? Did you put it in the same place, ie not inadvertently put it in a different folder
(I've actually typed the bulk of the post and come back to the top for this one, but):
Are you sure you're checking the right site?
Have you kept the same domain name?
Has the domain name propagated to the new server?
Is the CSS being loaded from the correct domain (has anything been hardcoded to the old server)
Let's go through a few broader options:
1. Check how many WordPress installs are on your domain
First off, it sounds like you may have two WordPress installations. If you have the backend setup correctly with your themes but you're seeing a plain site, it sounds like you're looking at another install. I'm not saying you do have multiple installs, but it is a place to start looking.
A question to ask yourself here is: In this plain looking site, do you see your content, or the content of a default site? If you see your content, you may jump ahead to section 2.
If you're saying there is a home page but you're not seeing it as available under static pages, either:
You're looking at another site (but there should be a home page* even in a default setup—from memory), or
You're Home Page title may have changed, or have become "unpublished", ie reverted to a draft, or pending review. Check the page:
actually exists,
has the title you're looking for
the slug hasn't changed
(*note: although it could be a Welcome Page I'm thinking of here.)
Double check the database
The easiest way to do this is to go into your database and see how many WP databases there are. Check each database and look for the underlying table structure, it sounds like you should be able to identify it pretty easily. If it's not a multisite install, the table prefixes should be wp_ unless you changed them somewhere.
While you're playing around in the database, Take note of the database name and table prefix.
Double check the folder structure
Have a look for a second instance of your folder structure, maybe you dropped it into the wrong place).
2. Check the WordPress installation is actually connected to the database
Check the WordPress configuration file wp-config.php is connected to the database. Check wp-config.php sample from codex, you'll want to see the correct database name and table prefix in there.
From here you should also check the username has been setup correctly and is as you expect it. Remember, the database name will likely have a different prefix between hosting providers, unless you've managed to keep the same login name with each provider. ie, I'm talking about the database prefix here, not the table prefix.
(another note: most database connection issues will result in errors appearing on the page in lieu of your site, which leads me to believe it's at least partially setup correctly.)
TEST: What you can do is rename the old wp-config.php to something else and don't create a new one, then visit the website and it will lead you into setting it up again where you can enter the database details (your site info will still be intact, this will only reset your config file, not the database, although it could reset the connection between the filesystem and database).
3. Domain name propagation and DNS settings with your new host
As I mentioned previously, are you checking the right server? Are you sure the domain name has been propagated (if you're using the same domain name that is).
Check the IP address with your DNS provider (for your domain name) is correctly pointed to your new server
Then check that from your command line by typing ping {your-domain-name} and see that your IP address comes up
Check the DNS settings with your web host are setup correctly and that your domain name points to where you want it to point to (ie, public_html or the relevant subdirectory there-of). (This resally does come back to point one, which if you covered it, this shouldn't be an issue
Check that you dropped the files (and all the files) into the correct physical directory, ie public_html (or sub-dir)
If none of these help, please leave a comment with any further developments you've made and as much info as possible, and we can start looking in other areas.
*notes about the database name:
when playing with WordPress directly, ie in the configuration files or the backend administration settings, the database will include your {username}[underscore or hyphen]{database-name}
when playing in phpMyAdmin, they will already be included and you will just provide the {database-name}.
Fellow this steps
export your sql from cpanel---phpmyadmin
make zip of your files in cpanel
import the file in new domain and extract it
create a database link to the new domain
go to new database which you have reacted through phpmyadmin--delete all the tables which was installed by wordpress.
import that sql file which you have downloaded from old website
and in phpmyadmin change the url to new domain name
Regards
Follow these steps:
export database from phpmyadmin.
zip your WordPress project via c-panel.
upload zip file on new domain via c-panel.
extract zip file.
create new database and import old database in new phpmyadmin.
configure user name and password and database name.
change url in database table. from wp_operation table home_url and site_url
Thanks

Need help moving Wordpress Multisite from local host to my web hosting server

I have encountered some dificulties moving my wordpress multisite from localhost to my webhosting server.I would appreciate if someone can post a tutorial how to do this step by step.I modified my wp-config and changed urls in posts table(guid column) to fit the domain name, but still not working.I may miss something.
Thanks in advance.Have a nice day.
I've seen a lot of these issues and successfully fixed it by doing some Google search. Sometime it's really hard to find solution to the specific problem you are having, but there is always an answer.
First i would like to tell you that you can make this process easier by using some plugins like: backupbuddy or Duplicator.
But if you want to learn the steps to do that manually, here are the details:
I'm assuming that you already have a local Wordpress site running with full access and you also have a web hosting plan with access to their control panel.
You also need FTP client to transfer files over to your server, i use FileZilla it's free and comes with all functionality you need for this or any other uploading purpose.
1: Export Wordpress database from phyMyAdmin, to do that go to http://localhost/phpmyadmin/ click on your wordpress database and now you will click on export from the menu. You will see custom option after you click export which gives more options, select all tables and use gzipped as preferred compression format. Now scroll down and press Go to download your wordpress database.
I'm doing the same thing while writing this so i don't make any mistake while explaining to you or anyone reading this.
2: Open the FTP client you have or download and install FileZilla, connect to your web hosting directory. Now the site uploading process starts, suppose you need the wordpress site to be on main url like example.com, in that case you will upload your wordpress files to public_html directory.
There are two windows within the ftp client the left one is mostly the local and right is remote, copy your wordpress files from local to remote which is your server.
3: It's now time to create MySql database on your online site.
Go to your web hosts control panel and in mysql databases create a new database, give it any name of your choice it doesn't matter.
Once the database is created scroll down to MySql users section and create brand new user for that database, next step is to setup privileges. Give that user all privileges.
4: Now import Wordpress database to your online site, in your control panel open phpmyadmin which is mostly under databases section, choose the database you created in step 3 now click on import tab, click choose file or browse and select the gzipped file you exported from your local site. Click import and your databases will be imported.
5: This is part where most of the people makes mistake, be careful doing this. In this step you will change the site URL to go online. In the database we just imported look for wp_options table (I'm assuming that you haven't changed your database prefix for security reasons yet) click wp_options table and click browse.
Look under option_name field, look for siteurl. Now click Edit button in the same lane.
Another windows appears at this point which shows you the current site url most probably http://localhost/something. Type in your website address here like: http://tech-diggers.com
Save once you enter the correct site. Do the same thing for Home under options_name field. Change the siteurl to your site address for home.
6: At this point if you visit your website it must be giving some error, that's because the last part is still pending. Go to your ftp client and on remote site edit wp-config.php file. Enter database name, user id and password save and upload back to the remote directory.
You can test the site now by going to your http://example.com/wp-admin
Finally you have your working Wordpress site online, now it's time to grab some useful resources for Wordpress: Best Web Hosting Service & Other Useful Resources for Bloggers

View a site without a domain WITHOUT updating hosts file?

I have a few sites I developed that I need to show my client for review. These are all redesigns of live sites, so they've had me upload them to their new hosting server, which is currently accessible via IP address because the domains are currently in use by the live sites.
I've set each site up as add-on domains in cpanel, and they all live in directories off the root, like 192.0.2.3/site1.example (for example).
However, these are Wordpress sites, and the database references the actual domain name (site1.example), so that it will be all set for launch when we update the DNS to point to this server. That means you can't actually see the site at that domain unless you update your hosts file. But there are lots of non-technical people that need to review the site, and updating their hosts file just isn't an option.
I'd rather not have to do a search and replace on the database to change the domain to 192.0.2.3/site1.example temporarily, just so they can view it. Because when we're ready for launch, I'll just have to do another search and replace to switch it back to the real URL. But it seems like that's my only option.
Is that correct, or is there another way they can view the site without me having to update all the URLs in the database?
The best solution here is to search and replace the URL just as you said

Resources