Steps to follow in moving a WordPress website from one server to another

Moving a WordPress website from one server to another is quite an easy process but there are a few steps that need to be followed:

  1. In the existing website, go into the Admin area and in the Settings/General Settings area change the WordPress Address URL and Site Address URL to the address that it will be on the new site.  Save the changes, but don’t try to go back into the website because it won’t work.
  2. Using PHPMyAdmin or similar product, export all the database tables into SQL format and save the exported backup file down onto your local PC.  Make sure that you check the option to include the “DROP” commands.
  3. On the new server, install the base WordPress package.  Check that the default WordPress screen comes up.
  4. Using PHPMyAdmin go into the database on the new server that you have just created. Select the SQL tab at the top of the screen.  Open the SQL backup file that you just downloaded to your PC and copy everything in the file to the clipboard.  Paste all from the clipboard to the SQL tab in PHPMyAdmin and execute the SQL.  This will completely rebuild the tables in the database so that they are identical to the database on the old server.
  5. Using FTP (try Filezilla) copy the WP-CONTENTS directory and all sub-directories and files on the old server down to your PC.   Then copy the WP-CONTENTS directory and all sub-directories and files to the new server, overwriting the files that were there.
  6. Now, if the URL to the WordPress site is changing at all, you need to run three SQL statements in the new database. Copy and paste, one at a time, the following 4 strings of code into the Run SQL query box, replacing the words and with your domains, and strike Go. Each time you run a query you should get a green check indicating the database was successfully updated.
    • UPDATE wp_options SET option_value = replace(option_value, ‘’, ‘’) WHERE option_name = ‘home’ OR option_name = ‘siteurl’;
    • UPDATE wp_posts SET guid = replace(guid, ‘’,’’);
    • UPDATE wp_posts SET post_content = replace(post_content, ‘’, ‘’);
    • UPDATE wp_postmeta SET meta_value = replace(meta_value, ‘’, ‘’);
    • When complete click on the Home icon and log out of phpMyAdmin.
  7. If you are changing hosting companies you will probably need to move your domain name.  Go to the company that you registered your domain name with and change the DNS servers to the DNS server provided by your new hosting company.  Once this is done it could take a little while for the change to filter through the internet so that your domain name will bring you to your new server, but it has been my experience that this has been happening in about half an hour of late.
  8. Once your domain is working and you can see your site setup on your new server, go in and check it out.  If you find that your permalinks are not working, go into the Permalinks screen in the Settings and resave the Permalinks option that you want to use.  I found that the setting in the Permalinks option selection was correct, I just needed to press the Save button to get it all working correctly.
  9. That should be it.

Forbidden 403 Error

When you get the 403 Forbidden Error and you can’t access any of your WordPress site, it is probably because the .htaccess file has been corrupted or is missing the “Options +FollowSymlinks” line at the top of the .htaccess file.

Backup your .htaccess file by changing it’s name to something else. Try to get into your WordPress site now. If you site does display, the .htaccess was the problem.

To create a new .htaccess file go into the Settings and use the Permalinks selection process. This may well break it again but it will create a valid .htaccess file.

If the problem is back after setting up the Permalinks the “Options +FollowSymlinks” line needs to be added to the .htaccess file right after the “<IfModule mod_rewrite.c>” line.

It should look like the following.

<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

What to do when Permalinks don’t work

I recently had a problem when setting up a new WordPress development environment on my local PC. The installation went fine. I selected Permalinks. I manually updated the .HTACCESS file to include “Options +FollowSymlinks”. I did the normal things and Permalinks just wouldn’t work. The problem ended up being that the “rewrite_module” in Apache was not enabled. I used Webmin to go into the list of Apache Modules and enable the “rewrite_module” and all is good now.

How do hackers workout the WordPress Admin user account?

I noticed recently after installing the Limit Login Attempt plugin (which is a great plugin) that hackers were continually trying to break the WordPress Admin account and they all seemed to know what the WordPress Admin username was, which bugged me.  I wasn’t just using “Admin”, which we all know is the default, I was using a custom Admin username which I thought was making it more secure.

What they were doing was executing the following:

which returns the Admin username in the URL.

The best way to stop this is to add the following in the .htaccess file in your website root directory, underneath what is generated by WordPress.

# Stop Author=1 hack
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/wp-admin [NC]
RewriteCond %{QUERY_STRING} author=\d
RewriteRule ^ /? [L,R=301]

Can’t Update WordPress or Plugins

I have recently had problems updating WordPress and Plugins on a number of my sites, getting caught up having to setup ftp accounts to allow the updates.  In search online I found a very simple solution.

In the wp-config.php file add the following line”

define('FS_METHOD', 'direct');

That fixed the problem for me.



Getting 404 Not Found after Permalink change

To allow the .htaccess file to override standard website configs, start by opening up the configuration file. NB: You will need sudo privileges for this step.  You may see a file in the sites-available directory for the website that you have created.  If this is the case, edit the file for your website rather than the default as shown in the example below.

sudo nano /etc/apache2/sites-available/default

Once inside that file, find the following section, and change the line that says AllowOverride from None to All. The section should now look like this:

 <Directory /var/www/>
                Options Indexes FollowSymLinks MultiViews
                AllowOverride All
                Order allow,deny
                allow from all

After you save and exit that file, restart apache. .htacess files will now be available for all of your sites.

sudo service apache2 restart

WordPress Permissions Update Error

When trying to upgrade WordPress on one of my sites I kept on getting the following error:

“The update cannot be installed because we will be unable to copy some files. This is usually due to inconsistent file permissions.: wp-admin/includes/update-core.php”

I found the answer on the following page:

To fix the problem I ran the following two commands:

sudo find /path/to/site/ -type f -exec chmod 664 {} \;

sudo find /path/to/site/ -type d -exec chmod 775 {} \;


In addition, the user and group must be set what Apache is running under.  On my Ubuntu servers that is www-data:www-data and the command, run from the root of the website (usually the wordpress directory) is:

sudo chown -R www-data:www-data {.,}*




MySQL Crashes each day after adding an extra WordPress site

I have a small VPS with only 512K memory and I added another WordPress site to it. In theory it should have worked OK, there is not a huge amount of traffic on the server and there was enough disk, but I found that after adding the extra WordPress site MySQL would crash each day at around the same time.  On doing a lot of research I found the following fix works:

Use the following in [mysqld] section of your /etc/mysql/my.cnf configuration.

performance_schema = off


UPDATE: The above fix seemed to work but after a couple of days MySQL crashed again.  The final solution that I found was to upgrade the VPS so that it had 1GB of memory rather than the 512MB that it had.


Using the Emergency Password Reset Script

This is an emergency script to use when you have forgotten the admin password to your WordPress website and all other methods of trying to reset it have failed.  I have copied this from: so that we’ll have a copy of this useful tool, even if the originally page is removed.   Continue Reading

WordPress Updates not being found so that WordPress is never updated

One of my WordPress sites was stuck on version 4.0.1.  Wordpress is currently up to version 4.5.2 and the update function kept on telling me that the WordPress software was currently up to date.

After Googling a lot and reading a lot of posts from people having the same problem, one post finally gave the answer.  The Cpanel had modified three of the core files so that they didn’t work correctly anymore.  Following the solution in the post I downloaded the Wordfence Security plugin and ran a scan.  It came back and told me that three core files didn’t match the corresponding files in the source repository and gave me the option to download the original version from the source repository.  On restoring all three files from the source repository the update function is again working.


Copyright © 2024