How to use Wordpress with localhost and a preexisting database on another server - mysql

I've been working on a Wordpress website on my web hosting server. But I wanted to start doing the Wordpress changes locally, while still using the database with all the posts and stuff that's already on the server.
I installed Wordpress on my computer, and had it connect successfully to that database, but going to localhost/website/wp-admin would redirect me to www.site.com/website/wp-admin, and then proceed to do everything on the server again, which I didn't want, and localhost/website would just appear blank.
I tried having Wordpress use a new test_database on the server, and it was happy with that. Wordpress started to run locally, localhost/website wasn't black, while using a database on the server. Even when I wiped out my local Wordpress and reinstalled it connecting to test_database, all the posts remained intact, and Wordpress was still running locally.
How come I was unable to get Wordpress running locally when I tried to connect to the first database?

You're trying to use the same WordPress database instance on two different URLs. You Can't Do Thatâ„¢. Someplace in the options table is the database's URL. It's used to construct many links in WordPress. That's why you're jumping back to the production server.
You can use a plugin like Duplicator to make a copy of your production web site to use as a staging server, or vice versa.

Related

How can I migrate a Locally hosted Wordpress site to a remote host?

I have a website on my locally hosted XAMMP server (Windows). I need to transfer this over to 123Reg.
The XAMPP server runs: PHP 7.3.2 and MySQL 5.5.5; and the 123Reg server runs:PHP 7.2.16 and MySQL 5.5.5
I have tried using Duplicator. It works however I cannot access the Wordpress backend (wp-admin) using any admin credentials or make a new one in the Duplicator wizard and via the database (it would just say 'Sorry, you can't access this page', and yes, I have tried deleting plugins and editing the .htaccess file with no luck). I have tried a manual migration (export and restore files and database) as well with the same issue as the duplicator one.
Currently, I have installed a new version of Wordpress on the 123Reg server can copied the wp-content directory from the XAMPP server to the 123Reg one. However, this is not enough. I need the whole site (including pages), cloned so they look exactly as they are on the XAMPP server on the 123Reg server.
I was expecting it to transfer the site without errors as the site is fine on my XAMMP server, but it's not.
Am I doing something wrong? I am not sure of what to do now so I would appreciate any sort of help.

How to setup local server for wordpress site with git

I'm working on a WordPress site via Sourcetree. The previous dev working on this project had set up a local server with Docker, however I have no experience with this.
My question is - how can I connect to localhost to start developing?
Note-
I've downloaded mysql, xampp and wordpress locally
I have experience developing wordpress sites locally (via an FTP such as FileZilla), however I've never done so with git included.
Thanks.
Try to follow these instructions:
https://premium.wpmudev.org/blog/setting-up-xampp/
Probably one thing that you are not doing properly is that your project doesn't sit in xampp/htdocs/myproject as that way you can access it through http://localhost/myproject

Wordpress duplicator moving from subdomain to root/domain

I created Wordpress website on localhost. I moved wordpress with duplicator plugin to subdomain for testing (dev.example.com). I created new mysql database and user for subdomain. Everything works fine.
Now, I would to move my wordpress from subdomain to main domain/root. On existing root there is still old website. I am going to delete everything in public_html.
Can i create new mysql database and user for root/domain; and move wordpress with duplicator plugin... just like i did moving from localhost to subdomain (I created new database for subdomain).
Is the process the same? Or is there better way moving from subdomain to root.
Best,
Klemen
Essentially yes you can do this, just make sure you backup the live site before overwriting it.
I use Duplicator all the time for migrating local dev sites to live domains.
Good luck!

Migrate Joomla 3 Site to new domain

I have built a Joomla site for a client on a development server. It soon needs migrating to the client's Live site, which will mean a URL change as well as a physical server change.
I'm new to Joomla, but having worked a lot on WordPress previously I know it's a piece of cake to migrate one WP site to another, especially with the dozen or so available plugins.
However, this doesn't appear to be so easy on Joomla. I have searched for the best practice to achieve this with Joomla 3 but cannot find what I need.
Does anyone have a suggestion for this?
There are in fact a two ways to achieve this and they are quite easy.
1. The first one is the manual way, that is:
Copy the files of your local joomla installation and upload them to
your server
Export your local database and import it on your server.
Edit the configuration.php file to your new server credentials -db
name, db user, db server etc.
2. The second one is through the akeeba backup component.
In this case you create a backup and then restore it on the remote
server. Detailed info
here.
After uploading your remote site you are advised to follow these
guidelines
to secure your installation.

Cloning whole blog ends in 404

I am currently developing a WordPress project on a Windows machine (XAMPP) with my partner on a Mac (MAMP).
I installed WordPress on my local /htdocs, edited themes etc.
At the end of this all, I exported my WordPress database through PhpMyAdmin for my partner to install the whole project on his machine.
He has the /wordpress folder and imported the SQL with correct database names etc.
But whenever he goes to localhost:8888/wordpress it results in a 404 page not found error.
why?
The problem is, there are a lot of serialized things in the wordpress database, what you can not just find / replace.
I moved from localhost to production a ton of times wordpress sites.
So what you need to do is to:
Dump the database from local
Copy the files to production server
Import the database, but do not open the site in browser!
Download the script from here.
Unzip, and upload this into a wp-replace directory
Go to http://example.com/wp-replace/
Follow the instructions. Replace the olddomain.com to newdomain.com/wordpress (do not use http and trailing slash, add port if needs)
Go to the dashboard, login, and refresh the permalinks.
Done