Moving wordpress site from subdomain to domain - wordpress

i want to move my wordpress site from (alpha.domain.com) to (domain.com). i have already old website on domain.com which is in php . what should i do ? any changes need to be done in database? So need your advice.

As atinder has mentioned in the comments, see here for official instructions from Wordpress.org. However, I would like to highlight the key points:
You need to move backup your files and database firstly, via cPanel/FTP/pointing the new URL to the correct directory. (this is the easy part)
Once you have moved them to the correct location, you will need to do the following to make sure that your URLs are correct:
Update Base/Site URLs
In phpMyAdmin or your preferred MySQL database manager, go to the wp_options table and change siteurl and home to your new URL. These two options would usually be the first two rows in the table.
Update hardcoded permalinks
Depending on what themes and plugin you used, you will also need to update hardcoded URLs in your posts and options. I recommend backing up your database before doing a full search and replace (to replace old url with new url), as serialized data will break if you simply do a raw search and replace.
If you are certain your database doesn't contain serialized data in wp_posts.post_content, wp_postmeta.meta_value, wp_options.option_value (simply do a search first to confirm), you may safely proceed with an SQL query as outlined here. NOTE: AT YOUR OWN RISK!! BACKUP FIRST!!
You can see this section from the instructions for plugins that will help perform safer search and replace.

Related

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

Moving WP site to another domain

I have simple 4.2 WP site with theme Twenty Twelve and Polylang plugin ver. 1.7.6. in domain mysite.co.nf. Now I deciced to move it to another domain mysite.newdmn.eu. I have copyed all files from old domain to new one using FTP. Then have exported DB to SQL script. Have edited SQL script by replacing strings mysite.co.nf with mysite.newdmn.eu using Notepad++. Then I have imported this SQL to my new site DB, edited wp-config to connect to new DB and from first point of view site is running except several things:
No header picture. (Actually this is not problem, but strange..)
No multi language icons and it is not possible to switch between languages.
Can't open one page - new server shows that it not exists. This is simple text page that looks the same like other ones. Link of this page looks the same structure like other pages.
How to solve these problems?
And what is best practices while moving WP sites?
Edit SQL by using editor is always a bad way to update the domain url. Because themes and plugins may serialize php objects into string format and store it in DB. If you replace domain url by using editor, it may break your site.
WordPress codex mentioned : https://codex.wordpress.org/Moving_WordPress#Changing_Your_Domain_Name_and_URLs
If you do a search and replace on your entire database to change the
URLs, you can cause issues with data serialization, due to the fact
that some themes and widgets store values with the length of your URL
marked. When this changes, things break.
The suggested way is to use search and replace tool like https://interconnectit.com/products/search-and-replace-for-wordpress-databases/, or some backup plugin like Duplicator or Backup Buddy.
Also suggested this well written article about WordPress migration.
http://www.smashingmagazine.com/2013/04/moving-wordpress-website/
For me, I always do it by myself without using any plugins. My steps is as follows:
1.move all files under wp-content
2.import db
3.do search and replace by using https://interconnectit.com/products/search-and-replace-for-wordpress-databases/
Few times I had to update not only domain but also file path on server.
But the best you can do is using Backup Buddy (paid) or Duplicator (free) plugin (or any other that fits you, but those two are the best imo, and I do at least few migrations a month).

Removing hard coded site URL from wp-config

After the IP address of my WordPress site had changed,
I had to hard code its address in wp-config.php:
define('WP_HOME','http://54.77.99.66');
define('WP_SITEURL','http://54.77.99.66');
When I delete the lines in wp-config.php, my site is no longer accessible.
How can I get rid of the hard coded entries and set my site's address in the UI (which is currently greyed out)?
I routinely move sites between domains as I test features, restore and test backups, etc. and I always just change the domain throughout the database. The problem with this approach is that many options are store in MySQL as serialized PHP arrays which include the length of a string as a value so you can't just perform a blind search and replace. However, a company called interconnect/it has a free product called Search Replace DB that is able to safely traverse and update these arrays. I say "safely" in that I've run it hundreds of times without issue but they still always recommend backing up your database first.
First download the software above, extract it locally and upload the folder to your server
Using your browser navigate to the folder that you've uploaded
In the search box enter your old site's domain
In the replace box enter your new site's domain
In the database area enter your WP database information
Press the dry run button just to see what the tool thinks should be updated. You'll usually see one or two items in wp_options and a bunch in wp_posts and wp_postmeta. If you have blog wp_comments might get some updates. Depending on your plugins you might get others, too. You can even click the view changes links to see what it thinks it should update.
If this looks good you can hit the live run button and let it perform the updates.
Delete when done. Very important. I'll say it again. Delete when done.
There are some things to be aware of when replacing text. If my site is example.net and my email address is chris#example.net and I perform a replace on just example.net it will change my email address, too. If my site is www.example.net (with the WWW) then I would search on www.example.net which wouldn't catch. I always audit the users just to make there aren't any domain conflicts. If there are, I just perform the above steps a second time, once for each user to change the email addresses back, but this is pretty rare.
The other thing to watch is text-based content about your domain. For instance, if you are keeping your old domain at example.net and spinning off a blog at example.com, the latter might have a blog post about how awesome products are at the former but the replace would point to the latter.
These are the only two edge cases that I've ever run into with this tool, however. Using this tool you should be able to avoid the WP_HOME and WP_SITEURL constants completely.
Also, just in case you are worried, the actual WordPress codex even references and recommends this product.
Changing Your Domain Name and URLs
When your domain name or URLs
change - i.e. from http://example.com/site to http://example.com, or
http://example.com to http://example.net - there are additional
concerns. The files and database can be moved, however references to
the old domain name or location will remain in the database, and that
can cause issues with links or theme display.
...
Use the Search and Replace for WordPress Databases Script to safely change all instances. (If you are a developer, use this option. It is a one step process as opposed to the 15-step procedure below)
This seems to work for me. Honestly not sure how it works:
define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST']);
define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST']);
I guess it does 'http://<yoursite>' where <yoursite> is replaced with whatever the address of the server is in your URL bar. Doing this, I can access my site both locally (i.e. via the local IP) and from other networks without issue.

Have you ever encountered Wordpress settings that wouldn't stick?

I'm in the middle of moving Wordpress from localhost on my local machine to the live web. I modified the wp_options table's siteurl and home values to point to blog.site.com/. It worked the first time I entered this url, but subsequent url entries would not display the blog page.
Is anyone familiar with this problem?
It's not really straight forward to change the URL of a wordpress site after the initial install because the database contains references to the initial url.
Have you tried following the steps outlined in these pages?
http://codex.wordpress.org/Moving_WordPress#When_Your_Domain_Name_or_URLs_Change
http://codex.wordpress.org/Changing_The_Site_URL
You can use this script to update the DB referees from the old url.
https://interconnectit.com/products/search-and-replace-for-wordpress-databases/
Once you change the url in the wp_options table and upload the new database, make sure the first thing you do is go into the live site and set your permalinks. Even if you just go in and click save. This should update the url accordingly. However, any links in the content areas, widgets, etc. will still need to be updated manually with the new domain.
There are also some tools to help with this type of migration. Haven't tried it yet, but have heard good things about WP DB Migrate Pro

Change Wordpress URL from example.com/wordpress to example.com/blog

It seems like an issue that has been talked about a large number of times, but for some reason, I can't seem to get it to work.
Goal: Change Wordpress site from example.com/wordpress to example.com/blog
Here is what I've tried:
Changed the Wordpress root folder from "wordpress" to "blog"
Then, in phpmyAdmin, changed the siteurl and home url's to example.com/blog
When that did not work, I also went into my theme's functions.php file and added:
update_option('siteurl','http://example.com/blog');
update_option('home','http://example.com/blog');
immediately after the opening
<?php
tag.
Is there something I am missing?
When your domain name or URLs change - i.e. from http://example.com/blog to http://example.com, or http://example.com to http://example.net - there are additional concerns. The files and database can be moved, however references to the old domain name or location will remain in the database, and that can cause issues with links or theme display.
If you do a search and replace on your entire database to change the URLs, you can cause issues with data serialization, due to the fact that some themes and widgets store values with the length of your URL marked. When this changes, things break. To avoid that serialization issue, you have two options:
1- Only perform a search and replace on the wp_posts table.
2- Use the Search and Replace for WordPress Databases Script to safely change all instances. ( If you are a developer, use this option. It is a one step process as opposed to the 15-step procedure below )
Info taken from http://codex.wordpress.org/Moving_WordPress
Search and Replace for WordPress Databases Script: http://interconnectit.com/products/search-and-replace-for-wordpress-databases/
You need to update all URLs in your database too.
Take a look at this script:
http://interconnectit.com/products/search-and-replace-for-wordpress-databases/
You could try this plugin:
http://wordpress.org/plugins/wp-migrate-db/
From its own description:
"Exports your database, does a find and replace on URLs and file paths, then allows you to save it to your computer."

Resources