In this article, we will talk about moving a WordPress site from one hosting provider to another; from hosting to Denwer (using Denver, you can make a full-fledged local host), as well as to a new Domain name or just another directory. There can be a lot of reasons for moving, we will not focus in more detail here, but we will only note that the most common reason is hoster dissatisfaction, which at one moment reaches its maximum. True, in most cases it will be enough to leave a request to the new host for the transfer, and he will complete this process for free (transfer from Denver is also free). Some have to change more than a dozen hosters, and only then it becomes clear which provider is the most optimal for them.
Common reasons for changing a domain name is the imposition of filters on the platform search engines or getting banned.
Sometimes these moments can be solved, but often you have to choose a new domain and start promotion from the beginning. However, it does not matter at all what moments led you to the need to transfer.
Perhaps you just needed to deploy a version of your site on your computer in order to perform any work (working on a localhost using Denver is many times faster, and moreover, with this version you can do anything with settings and plug-ins, without any fear for the performance of the web version). We advise you to have an offline version of your site, just in case. Also note that with the help of Denver you can work with an unlimited number of sites.
Transferring a WordPress site to another host
Consider first the first method of transferring the Vodpress site. So, to start, you need to get to the old host and backup the entire current file system and databases. Often, backups are created in the hosting root directory in archive format. To download these files, we recommend going via FTP (you can use, for example, FileZilla or Total Commander) or through file manager hosting. Download the created archives to your computer, extract the database from the archive in advance.
If the above method did not work, then you can get copies in another way. You should go to the hoster's file manager, select the entire folder where your site is located and click on "Create archive". After the archiving is completed, download the archive to your HDD, and do not try to download all the files of your site separately, because the probability of errors is too high; some of the files may not load at all, and the download process will take a lot of time.
Now go to the management section MySQL databases– phpMyAdmin. Select your database from the drop-down list, then click on the "Export" link and click "OK". That's it, now save the resulting file. After that, you will have a database dump in the form of a file with the .sql extension and a package with all site files on your disk.
Transfer from virtual to local host using Denver (and vice versa)
With the help of Denver, you need to upload files to its folder, for example: C:\WebServers\home\newresourse.ru\www. The database must be added via phpMyAdmin (without an internet connection, go to the URL: http://localhost). Similarly, you can get files from Denver and upload them to the virtual host you need.
Transferring data from a computer to a new hosting
The new hoster will need to go to the "Databases" section and add a new user and a new database, as well as come up with a password and be sure to remember it. Now we go to the phpMyAdmin panel, look for the "Import File" button and upload the .sql database to the new host.
After that, you need to find your archive with the files of the Vodpress site and upload it to ftp. Must be filled in desired folder, otherwise the site will not be recognized by the hosting (often, this is a folder called public_html, but it can also be called www, httpdocs or something else). Whatever it is named, the directory must be empty.
Set up a connection to the database and set permissions
We are looking for the wp-config.php file, and change the connection data in it:
define("DB_NAME", "your_database_name");
define("DB_USER", "database_user_name");
define("DB_PASSWORD", "database_password");
Additionally, you need to set attributes 777 for the wp-content/uploads directory and all internal directories. You can do this via ftp or in a regular manager. That's all, now your site has been uploaded to a new hosting, but do not forget about the domain name.
Linking a domain name to a new hosting
After completing all of the above, your site should already work with the new host, but you won’t be able to check this, because the domain will still be assigned to the old host. To correct the situation, you must:
- Check with the new hosting provider for a DNS server. By the way, this info can be indicated in the letter that you received after registration;
- Now go to your domain registrar's office. The registrar can be an old hoster or specialized services like 2domains.ru. In any case, in the domain control panel, you need to find the "Manage DNS servers" section and change the DNS data to new ones.
We'll have to wait a bit for the changes to take effect. Domain binding can take up to 3 days, but experience shows that after about 2-4 hours you will be able to use your site.
Moving WordPress to Another Domain or Folder
If your resource needs not only a hosting move, but also a domain change, then this is a completely feasible task, but still you will have to face some headaches. This is due to the fact that all paths in WordPress are impregnated absolute links, and this shortcoming will have to be dealt with manually. Well, what to do, let's talk about everything in order:
- After downloading the dump of the old database from the old hosting, you need to open it in an editor (for example, Dreamweawer) and change all records about the old domain to the new ones.
- Changes also need to be made in the robots.txt and .htacces files (we also replace all references to the old site with the new one);
- Making adjustments to the site files is optional, so if after completing the two points described above you have earned a site, then you can skip this one. To search, you will need to unpack all the files of your WordPress site, and look for mentions of the old domain in them.
Moving a site to another folder
To transfer the site to another folder, for example, to site.ru/blog, you need to make the following lines in the .htaccess file (changes in bold).
RewriteBase /blog/
RewriteRule . /blog/index.php [L]
Transferring a site using SSH
This is the easiest and most convenient option for transferring a site, and this method takes only 15-20 minutes. And besides, everything is almost completely automated, no extra gestures will be required. But in order to use SSH, you need to have shell access to your account, which will ultimately make it much easier migrating wordpress site. So:
- In the hosting panel, you need to activate the entire site;
- We launch the SSH client, log in with our account and make a backup using the command:
mysqldump -u USERNAME -pPASSWORD BD_NAME > dump.sql
(what they are responsible for, the fields name, password, and database name - we think it’s understandable; spaces should be exactly the same as it was done in the above command!).
You can use WinSCP as an SSH client - a very functional program! Damb is best packed into an archive, since it is perfectly compressed into an archive.
Now you need to go through the SSH client to your hosting folder and download the previously created archives and database using the commands: wget http://site.name/site-archive.zip
and wget http://site.name/dump.zip
The download process will be very fast, because all the files will be transferred to the new host, bypassing your computer's hard drive. The resulting archives now need to be opened using the control panel of the new host. The database is imported using the command (an empty database must be created beforehand):
mysql -u USERNAME -pPASSWORD -D BD_NAME< dump.sql
As you can see this technology simplifies the transfer of the WordPress site to another hosting. If the hands grow from the “right place”, then there is nothing complicated here.
Errors that occur when migrating WordPress
If your site has not launched, then here are some common examples of errors:
- If a tab opens where you are prompted to install WordPress, it means that an error was made when importing the database. You can try dropping all tables and uploading a dump;
- If you see the hoster's greeting, then most likely you did not delete the files from the public_html folder before unpacking the archive (you can try deleting the index.html file);
- The error "Error establishing a database connection" pops up when the data in wp-config.php was incorrectly registered.
Now you know how to transfer a WordPress site to another host, as well as from Denver and back. We hope that after reading the material you have no questions left, and if you have any, write them in the comments.
About 17% of websites are built on the WordPress platform. This CMS is gaining popularity in most developer circles. What about existing sites, on other engines or without them at all? Does this mean that moving a site to a wordpress platform will take a lot of time, effort and money? Or do you need to start all over again?
Moving a website to WordPress is actually easier than you might think. In this article, we will walk through the process of moving a website step by step, to real example. We will try to cover and discuss all the existing problems with this.
Basic Steps
Here are the top things to keep in mind when migrating your site to WordPress:
- Evaluate an existing site. Work carefully when viewing the pages of an existing site. Define all content types (pages, photo galleries, resource pages, etc.), consider fields and forms. Write everything down on paper and create backup existing site.
- Prepare the habitat for the new site. Set up WordPress and get everything ready to import content.
- Content import. Transfer content to a new platform. For small sites, this can be done manually. For large projects, plugins can be used.
- Transfer the site design. Customize your default WordPress theme to match the design of your existing site.
- Review, test. Carefully check everything again and back up the new site. Make adjustments, set up a redirect url from the old site to the new one. Test!
This is the basic plan for migrating a site to a new platform. Now let's look at each of the stages in more detail.
Start with a plan
The key to a successful site move is the evaluation of an existing web project. You need to figure out how to import and structure content in WordPress. The main points of site migration do not change, all the complexity is in the details that are specific to each project.
Below is a list of questions to consider when evaluating content:
- How much content should be imported? Number of pages, images, etc.
- Maybe import the content manually? Or do I need to use a tool?
- If using a tool, does it exist?
- Can content be organized into "posts" and "pages" or is it different from the standard types?
- Do I need to transfer additional content elements (input fields, examples, videos, etc.)?
- Will the URL structure change? If yes, then we must not forget about the redirect from old pages to new ones.
- Is the content open to public access? Or are there pages for registered users only?
Before you transfer the content, you need to prepare wordpress. If you're just experimenting, . Otherwise, you need to do it on the hosting.
Once WordPress is installed, you're ready to go!
SettingURL
Go to Settings -> Permalinks to make changes. In most cases, links are best stored as a post title.
User Accounts
If users have been registered on your site, you need to create accounts for them in the installed wordpress. Once the site migration is complete, it's a good idea to let users know by email.
Required plugins
Plugins are selected for the specific needs of the site (contact form, content slider, gallery, social bookmarking, etc.). Here is the official plugins directory. The only thing to note is the organization Reserve copy data (backup).
Importing content into the WordPress platform
This is a routine and responsible job!
If your old site used a CMS, there is an option to automatically import content. Review the list of scripts that allow you to do this. Follow the instructions and do it!
If your old CMS is not listed, or the site is self-written, with no more than 100 pages, then it's best to do everything manually. Copy and paste content, making note of the transferred page urls.
If you have a database with several thousand content at your disposal, then you will have to take care of a specialist. Or find an automatic import solution.
Site design transfer
If you are not so critical new design, you can just pick an existing theme. Or correct the standard one (replace the logo, footer and change the color scheme).
In the case of transferring a site promoted and recognizable by users, it is best to keep the design the same.
Working with source code
From my own experience, it's best to work with the source code in the browser. If you take files from the hosting, you can make a lot of mistakes. In the browser, we see the site as users see it.
AT Google Chrome this is done like this: Menu -> Tools -> Source, or pressing right button mouse to open the context menu.
Create a theme
Style file
The first step in creating a theme is to copy the existing styles into the theme's wordpress stylesheet: style.css
To do this, just open this file for editing, change the information about the theme (commented out at the beginning of the file), insert styles from the old site.
Don't forget about the url of the images! Most likely they will change due to the new folder structure. Therefore, keep a close eye on this both in the style file and in the theme, respectively.
Site Header
The next step is to create the top of the site. Here it is necessary to combine the structure of the current html code With WordPress code template. In our example, we will act like this:
- Duplicate the HTML structure of the old site
- Replace Static Menu with WordPress Menu
- Let's use the WordPress title tag and leave the wp_head hook.
- Let's merge other relevant tags from the old site header.
Let's look at the code!
Old header HTML code
Vegan Food Pyramid
New header code (HEADER.PHP)
Vegan Food Pyramid
"primary", "container" => false, "menu_class" => "menu")); ?>Let's take a look at what we've done!
Make sure you migrated the old one. doctype. Otherwise, using the new HTML5 doctype for code from old specs can cause template breaks (especially in older browsers).
Meta tags
As a rule, all main tags are transferred. The exception in our case is the connection of the style file, which is inserted automatically using wp_enqueue_style in file functions.php
Scripts
Scripts can be tricky. If the script is connected to each page of the site (for example, the main script file or font script), then you can safely write it in the header or footer of the theme. If you need to connect only on a specific page, then conditional tags can be used. The best way is to register all scripts and add them with wp_enqueue_script.
Pasteat the bottom tag. WordPress uses this to include its own scripts and theme styles. Also for installed plugins. Without wp_head, most front-end plugins won't work.
body_class
Notice the application of ourtag. WordPress uses it to provide a series of useful classes for
tag. These classes are inserted depending on the page type automatically.WordPress menu
WordPress menu output is one of the most difficult tasks when transferring the site to this engine. In our example, we have a menu with simple markup that uses active class (generated with using PHP) to determine which page is being viewed. Function wp_nav_menu is very flexible and provides many built-in solutions for organizing menus. In the example, we have taken the styles from the active class and placed them in the wordpress equivalent current-menu-item class.
Site Footer
As a rule, the footer of the site changes the least. Everything is the same as in the case of the site header. Let's merge the HTML code.
OldFooter HTML code
New footer code (FOOTER.PHP)
Some of the footers are difficult to transfer to wordpress theme. For example, which contain menus and various widgets. Most of the footers are simple, like in our example. Don't forget to include the maintag before