Wordpress Change URL after Migrating to Amazon EC2 - php

I am doing migration of Wordpress from one Amazon EC2 instance to another Amazon EC2 instance after it is messed up. So I did the installation of LAMP from the AWS documentation. I have moved my Wordpress contents into /var/www/html. I have also prepared the database accordingly and run the .sql backup file.
But then when I go to the IP address, it just could not load. My guess is the current Wordpress is using the old IP of the instance while I now have a new IP for the new instance. How do I fix this?
So far what I did to get access into the website:
Based on https://codex.wordpress.org/Changing_The_Site_URL I have put below code in my wp-config.php file
define('WP_HOME','http://X.X.X.X');
define('WP_SITEURL','http://X.X.X.X');
But it did not work. Any guidance is highly appreciated. Thank you.
UPDATE:
Sorry for being unclear about the observation. Says my old IP was http://1.1.1.1, and my new IP is http://1.1.1.2. After the changes, when I try to go to http://1.1.1.2, it just like take some times to load then suddenly it tries to bring me back to http://1.1.1.1. And of course eventually I'll receive time out error message because old IP is no longer available.
I am using Apache web server, latest Wordpress 4.5, http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/hosting-wordpress.html#wordpress-troubleshooting

So I managed to find the workaround after adding the .htaccess file. To summarize, here are what I did:
Put the define function in wp-config.php
change WordPress site URL with the wp-cli with the help of AWS documentation http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/hosting-wordpress.html#wordpress-troubleshooting
Put back the .htaccess file into /var/www/html and change the previous IP to current IP
Last thing I did that does the magic was clear cache in the browser. And finally my website now could be opened. Thank you for the comments above and that really help.

Related

How do I upload my Wordpress code files from previous website onto local host Wordpress website which I created via Xampp?

I have Wordpress code files from an old website which I downloaded from WP File Manager that I want to look at on my local host. I have downloaded Xampp and set up a local host Wordpress website.
How do I now upload the code Wordpress files that I have, in the admin section on my local host, so I can see the front end of the website from the Wordpress code files that I have?
I have tried uploading the files via WP File Manager on the local host version, but it does not work correctly, because it has all the code files from local host website, so it's duplicating.
Thanks for your help!
I'm no native speaker, so errors may be excused.
As it states answer and not solution, i'll try to give some directions.
Your question has nothing to do with programming. There are better sites on stackexchange for that.
No need for a new WP instance, as you have a copy of the old one. Put it under your \xampp\htdocs\ folder. I imagine WP will need an appropriate .htaccess file as well, if the File Manager didn't get you that too.
Get a copy (aka dump) of the database from the old instance. Replace all references to the original url with your localhost adress within the dump.
Create a new db on your xampp-setup and import the modified dump into it.
edit the wp-config.php if and where necessary
Hope and pray it'll run, expect errors and further work

After deploying wordpress project to server not loading wordpress

I am working on a WordPress project, the job is to deploy everything from the old server to the new server.
So I downloaded everything from the old server.
I deployed a WordPress project to paid hosting, I deployed manually by pushing all the public_html folder to the server.
First, without a database connection, it was showing me a database connection error but after the database connection, it is showing me a hosting page instead of my WordPress project page.
How can I fix it and is there a configuration that needs to be fixed?
Kindly guide me and help me in this matter.
Also is it a domain configuration issue?
The domain is configuration is on the old server and I didn't set it up for the new server yet.
Thanks.
I faced similar issues yesteday when i tried to move my woocommerce exercise from localhost to my domain(live hosting),broken all links,images,routes etc ...There is no way to fix all that whithout paid plugins, maybe someone can go through whole db and change URL-s,i cant,and after that, the question remains whether I have problems elsewhere in the local WP code,who know where in code i also have embed "localhost" URL.
I cant give you solution but i must share my frustration with this tehnology which doesnt allow normall development process like 1)development -> 2)testing -> 3)deployment .

Trying to work on a client's Drupal site from my local machine

I have a client who wants me to update their Drupal site. I've never done this before, and I want to work on it from my local machine just in case something goes wrong. I have no idea where to even start!
First off, how do I access my client's site files so I can get them onto my computer? I've tried entering the information the client gave me into Cyberduck, but it won't give me access. Is there another way to get access?
Also, how do I host it locally? I have XAMPP, but I'm not sure how to use it.
That being said, I have found a few forums that should help me set up the local server. I just don't know how to get the files from the live server to my computer.
I know this is a super noob problem, but I could use the help. Thank you!
Well, for the basic question, you have to get the correct credentials from your client. There's no alternative, really :D
While you're at it, you'll want a copy of the site's database too.
For the question "how do I host it locally?" Here's how I would go about it.
Get the site into version control.
Given that you were given (S)FTP credentials, I'm guessing the site is not version-controlled. If that's correct, then that is probably the very first thing you want to do. This will allow you to keep track of the changes you've made on your local site that are different to the production version.
Create an empty directory on your computer.
Navigate to the directory in a terminal and run git init.
Add a .gitignore file to that folder (you can create your own, or use one customized for Drupal).
Download the site's files into the directory created in step 1.
Add the files from the in the directory to the git repository by running this command in a terminal: git commit -am "First commit of Drupal files to repository."
There's a good help page about working with Drupal in git on drupal.org.
Create and populate your database.
Get a database dump from the live site.
Create a new database and database user on your machine.
Import the database dump into your new database.
Record the database credentials in settings.php or settings.local.php and store them somewhere safe, preferably in a password manager.
Change the database credentials in settings.php or settings.local.php to match the credentials of the database you've just created.
(For safety and to avoid confusion, I always create local databases with a different name, user, and password than the live site has. This means if your local credentials are compromised, the live site isn't, and it means you can't connect to and change the live site's database by accident.)
Set up the webserver in XAMPP
Create a new site in XAMPP called e.g. example.local that points to the directory that contains the file index.php
Add the following line the file called /etc/hosts on your computer:
127.0.0.1 example.local
Test that this works in a browser by visiting e.g. http://example.local or http://example.local/robots.txt.
Move your local changes to the Production site
How you will be able to do this depends to some extent on your client's web-hosting infrastructure, and what version of Drupal your client uses. but in any case, you will have three separate concerns for changes you make:
Code changes
You will need to deploy changes you make to the code back to the server. Ideally you would probably do this via Git either by cloning directly into the live site or (far better!) as part of an automated build process. By the sound of it, you may just have to FTP the changes back up.
Be careful not to re-upload your modified settings.php or settings.local.php file!
Content changes
You probably have to test some/all of your content changes locally and then recreate them on the live site. Because your client may have made changes to the live site while you were working, you can't risk importing your local database into the live site.
Configuration changes
Changes to configuration should be managed in code (i.e. as part of 1. Code changes above) if that's possible. In Drupal 7, the Features module is usually the best way to accomplish this (here's an answer I wrote describing the Features workflow). Drupal 8 has the Configuration Manager. Be aware that these two tools can both be tricky to use well.
Your client needs to gave you access to the files so you can put them into htdocs on XAMPP, then you need the database (also provide by the client), start XAMPP, create a new database on localhost/phpMyAdmin and import the db of the site. On the proyect code go to sites/default/settings and change the db settings to your local settings. Then you can go to localhost/{your-proyect} and it should work.

Best process for migrating WP to new host with limited access to original files?

I am working on moving a WP site from a host that a web agent in Singapore made for a client, to my host.
The only files they were able to provide me for now is a compressed folder of what seems to be the public_html folder from the current host server. Looks like it has all the actual files, but not the original SQL database.
I am having two issues right now...
1) We do not yet have the domain. I set up a WP install on my host, and copied over the files that were provided to me. But now when I try going to wp-admin, it redirects me to the domain (which is on the pre-existing host of the web agent in Singapore). I looked in wp-config for WP_HOME or WP_SITEURL, and these values were not in the file. And since we do not have the SQL, I am not able to edit the database through SQL queries either.
2) It looks like the current config files are set to access a database on
'us-west-1.rds.amazonaws.com' (I am assuming this is the main host as well). Since I have the database host/user/password, is there any way I could use this access to download the SQL and transfer it to my server?
I don't use WP much, so any advice would be appreciated. Not sure if I could get this working with the limited access I have, or if I need to request a backup of the original SQL, or... ?
If their database server is set to accept connections only from a specific host(s) then you will not be able to connect.
But if you can, here is a detailed guide on how you can migrate the wordpress installation.
https://codex.wordpress.org/Moving_WordPress

Wordpress - moving to production server issue

I planned to move my Wordpress site from my Xampp server to my production server. I changed the address under the 'Administration - Settings - General' panel. However, unfortunately I was not able to move the actual files to the new location via ftp, as my hosting network appears to be down.
I want to continue working on the project in my local server, however, when I tried to access the WP-admin login screen to login to my site, it automatically redirected me to the newly specified address of the site (which is currently empty).
I am now stuck outside, unable to log into my site. Has a constant been changed somewhere, or does anyone have a fix where I could somehow undo the changes that I have made?
Thanks!
Best Regards,
Robert Young
London, UK.
You can re-set the correct URL working on the MySql DB. In the table "wp_options" you can find "option_name = 'www.example.com';".
Here is a nice free plugin which handles moving Wordpress sites from one host to another:
https://wordpress.org/plugins/duplicator/
It is an easy way to complete the job, without having to get your hands "dirty" with database and configuration files modifications. Hope this helps!

Categories