Migrate a WordPress web site to DreamHost

DreamHost is one of the recommended WordPress hosting providers. The DreamHost website has an extensive knowledge base, but the necessary steps to move your live site from another provider are scattered over multiple pages at https://help.dreamhost.com/hc/en-us/articles/214693178-How-to-manually-migrate-WordPress-to-DreamHost.

These steps will guide you through the streamlined migration process.

At your old provider

Create a site and database backup of your site at the old provider and save them on your workstation.

At DreamHost

Create an account at DreamHost.

If you arrive at the DreamHost site from https://www.cnet.com/web-hosting/ you get 50% discount on your initial hosting plan terms. The price will increase to the regular amount when you renew your hosting contract after 1 or 3 years.

It can take DreamHost an hour to activate your account. You can log into the control panel, but you have to wait for the account activation to be able to set up your site.

Create a fully hosted site

  1. In the DreamHost Panel select DOMAINS, Manage Domains and click the Add hosting to a Domain / Sub-Domain button
  2. Enter the name of your domain, select Remove WWW:… , and make a note of the Web username and Web server name.  When you will upload the site, make sure you use the newly created Web username and Web server (+.dreamhost.com) with the SFTP protocol. (FTP will be disabled for that user). When you save your changes, the new username and password will display on the screen. Click the Fully host this domain button.

  3. DreamHost creates a directory for the new user in the home directory on the web server and a subdirectory for the website.

Temporary domain name

If you want to keep your existing domain name at the original location until the new site goes live at DreamHost,  create a free temporary subdomain, MYDOMAIN.dreamhosters.com

  1. Return to the Manage Domains page and click the Add Hosting to a Domain / Sub-Domain button again,
  2. Scroll down to the Mirrored section. Enter a sub-domain name using dreamhosters.com, select your site from the drop-down, and click the Mirror this domain button.
  3. Open a web browser and navigate to MYDOMAIN.dreamhosters.com. You should see this page:

Create a MySQL database

  1. On the left side select GOODIES and MySQL Databases
  2. If you use the temporary domain name, you need to use it for the database hostname too. If you move an existing WordPress site, for the easier configuration, you can keep the same database name, username, and password that you had at the old site.
  3. Update the wp-config.php file on your workstation with the new values. Even if you keep the database name, username, and password values, the DB_HOST will be different, because the site is now at a different provider.
    define('DB_HOST', 'mysql.MY_DOMAIN_NAME.dreamhosters.com');

Import data into your database

  1. On the left side select GOODIES, MySQL Databases, and in the middle select phpMyAdmin next to the database name
  2. Make sure the SQL script on your workstation starts with the database selection command. If the instruction is missing, add the line:
    USE MY_DATABASE_NAME;

    For some reason, the MySQL Workbench cannot interpret the encoding of the SQL file, use a better text editor to edit the file, otherwise international characters in the data will be corrupted.

    The Microsoft SQL Server Management Studio is perfect for this purpose.

  3. On the Import tab click the Choose File button to select the database backup SQL file on your workstation and click the Go button

Update the site URL in the database to match the temporary website address

On the phpMyAdmin web page

  1. Select the Browse tab, on the left side select your WordPress database, and in the database click the wp_options table.
  2. Click the Edit link in the siteurl row. This will automatically open the Insert tab,
  3. Update the siteurl value in the wp_options table and click the Go button,

Upload the WordPress site files to the new web server

Use an FTP client to upload the files to the site. The site host user only has SFTP rights, so make sure you configure your FTP client accordingly. Use the web address, username, and password that you used, when you set up the fully hosted website above.

To rebalance the load between their web servers, DreamHost time-to-time moves websites from one server to the other. Use the subdomain we created above, to access the FTP directory, as it will always point to the correct web server.

  1. If you use FileZilla, create a new site for the web user, and select the SFTP protocol,
  2. Make sure you update the wp-config.php file with the new database connection values, and upload it to DreamHost,

Test your new site

The home page of the new site should be accessible at the MYDOMAIN.dreamhosters.com address we created above.

When you click on any of the post titles, you may get the following error message

Not Found

The requested URL /archives/… was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Update the permalinks

The WordPress database still contains the absolute locations of your HTML files and images. To refresh the permalinks of your site

  1. Log into your WordPress site,
  2. On the left side select Settings, Permalinks, and click the Save Changes button.
  3. After a few seconds the site should start to work.

Point your domain name to the new site

When you have successfully tested your new site, you can point your domain name to the DreamHost webserver. The DreamHost knowledge base will help you at https://help.dreamhost.com/hc/en-us/articles/215412347-Updating-your-DNS-after-your-WordPress-site-has-been-migrated-to-DreamHost

IMPORTANT: If you use your domain name to connect to Office 365 or other services, do not switch to the DreamHost name servers. Use “Option #2 — Pointing your A records” on the DreamHost knowledge base page above, to set the IP address of your website in the DNS record.

Configure WordPress to use the final domain name

To be able to test our site with the temporary subdomain we have updated the database. Now it is time to change the value back.

  1. Open the MySQL management utility
  2. Select the Browse tab, on the left side select your WordPress database, and in the database click the wp_options table.
  3. Click the Edit link in the siteurl row. This will automatically open the Insert tab,
  4. Update the siteurl value in the wp_options table and click the Go button,

Test your site with your domain name

The home page of your WordPress site should load without error. If you get the error again:

Not Found

The requested URL /archives/… was not found on this server.

Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.

Update the permalinks again. See Update permalinks above

The FastCGI process exited unexpectedly

When you install WordPress on a Windows machine you may get the following error message:

HTTP Error 500.0 - Internal Server Error
C:\Program Files (x86)\PHP\v5.5\php-cgi.exe - The FastCGI process exited unexpectedly

Detailed Error Information:
Module
 FastCgiModule
Notification
 ExecuteRequestHandler
Handler
 PHP55_via_FastCGI1
Error Code
 0x000000ff

The error message is misleading. If you open the Application events in the Event Viewer you may find the following

Faulting application name: php-cgi.exe, version: 5.5.38.0, time stamp: 0x578fc02c
Faulting module name: MSVCR110.dll, version: 6.3.9600.18233, time stamp: 0x56bb4e1d
Exception code: 0xc0000135
Fault offset: 0x0009d3c2
Faulting process id: 0xcec
Faulting application start time: 0x01d24603ad650d40
Faulting application path: C:\Program Files (x86)\PHP\v5.5\php-cgi.exe
Faulting module path: MSVCR110.dll

The key is the MSVCR110.dll

This DLL is part of the Visual C++ Redistributable for Visual Studio 2012 Update 4. Download the 32 bit version, even if you have a 64 bit operating system, from http://www.microsoft.com/en-us/download/details.aspx?id=30679

After the installation WordPress will start to work without reboot.

 

How to add sample programming code to a post or page in WordPress

Double quotes

When you write a post or create a page you may want to add sample program snippets to it. If your code contains double quotes (“) the WordPress page will display different characters for the opening and closing quotes, like in this   “example”.

Unfortunately these characters differ from the quotes you use for programming, so if someone pastes the sample code into a code editor the compiler will not understand them.

To force WordPress to display your lines as those were intended

  • Paste the sample code into the article in Visual mode
  • Switch to Text mode and place <code> and </code> tags around the code snippet

 HTML or XML

When you insert HTML or XML code into you page make sure you keep the order described above. The visual editor will convert the < and > characters to &lt; and &gt;, so the WordPress engine will not interpret your sample code as part of the HTML of the page.

If you enter the following in Text mode

<code>
<html>Text</html>
</code>

WordPress will remove your < and > characters and the page will display

Text

How to modify a WordPress theme

There are two ways to modify a WordPress theme: the fast way and the smart way.

The fastest way is to edit the files of the theme by selecting the files with the “Appearance”, “Editor” menu option. The drawback is that when the theme is updated your customizations will be wiped out. The update process will overwrite the files you changed, so all of your changes will disappear.

A better way of modifying a theme is to create a “child theme”. This has two advantages:

  1. By creating a child theme you maintain the changed files in a separate theme (the child theme) so when you update the original (parent) theme your customization is not affected.
  2. You keep a separate copy of your changes in the child theme, so you can always easily find your modifications without reading through the theme files. You will only maintain the changed lines from the style.css file and your functions.php file will only include your custom functions. Your images folder will only contain your image files.

 

In this tutorial we will create a child theme for the Simplify theme

  • Use your favorite FTP application (mine is FileZilla) and create a folder for the child theme in the wp-content/themes folder
    • Right click the “themes” folder and select “Create directory”

filezilla create directory

 

  • Enter the name of the folder of the child theme

filezilla create directory name

 

  • Double click the new folder name to open it

filezilla navigate to directory

 

Right click the empty area of the directory listing and select “Create new file”

filezilla new file

 

Enter style.css as the file name and click OK

filezilla new file name

 

  • Log into your site as administrator,
  • Navigate to the Theme Editor,

wordpress appearance editor select

 

  • In the upper right corner select the child theme and click the Select button

wordpress theme editor select theme

 

  • In the upper right corner click the “Stylesheet” to open the style.css file

wordpress theme editor select styles file

 

Copy the following to the editor window.

  • Enter the name of the new child theme to the “Theme Name” line
  • Replace “simplify” with the name of the original theme folder.

 

/*
Theme Name:     Simplify Child
Theme URI:      http://example.com/
Description:    Child theme for the Simplify theme 
Author:         Your name here
Author URI:     http://example.com/about/
Template:       simplify
Version:        0.1.0
*/
@import url("../simplify/style.css");

 

  • Click the “Update File” button to save your changes

wordpress theme editor update file

 

Select and activate the new child theme

  • On the left side select “Appearance” , “Themes”

wordpress themes select

 

  • On the theme list click the empty image of the new child theme you just created

wordpress themes select child theme

 

  • Click the “Save & Activate” button to activate the child theme

wordpress theme activate

 

 

 

For more information see:

http://codex.wordpress.org/Child_Themes

Date specific header image in the Witcher World WordPress theme

Have you ever wanted to display specific images on certain dates in the header of your WordPress page like Google does?

If you want to automatically set the header image based on the date there is an easy way to do it. This way you can display a prepared image on certain dates like Independence Day, your birthday, or as in this example on the International Women’s Day, March 8th.

In the original Witcher World WordPress theme there are two ways to display header images: one selected image or a random image from multiple uploaded header images.

If you have access to your site via FTP and are not afraid of changing some PHP script in your Witcher World WordPress theme follow the simple steps below:

  • Upload a 988 pixel wide and 300 pixel high image to the “images” folder of the your Witcher World WordPress theme
    • Name the image “header_womens_day.jpg” (without the quotes)

wordpress witcherworld images folder

 

  • Log into your WordPress site as an administrator,
  • On the left side click “Appearance” and “Editor”,

wordpress appearance editor select

 

  • On the right side select “Header”,

wordpress theme header edit select

 

  • In the editor find the following line. That sets the header image of the theme.

<div id=”header”<?php if(get_header_image() != “”) echo ” style=’background-image: url(“.get_header_image().”);'”; ?>>

 

  • Replace it with the following script:

<div id=”header”
<?php
$today = date(“m-d”);
$templatedir = get_template_directory_uri();
$background_image_url = “”;
if ( “03-08″ == $today ) {
// Women’s day
$background_image_url = $templatedir.”/images/header_womens_day.jpg”;
} elseif (get_header_image() != “”) {
$background_image_url = get_header_image();
}
echo ” style=’background-image: url(“.$background_image_url.”);'”;
?>
>

 

  • At the bottom of the page click the “Update File” button

wordpress theme edit update file button

 

On every March 8th the “header_womens_day.jpg” image will be your header image. The  date(“m-d”) function returns the month and day in the  UTC time zone, so you will only see the change when it is March 8th in London (8 hours ahead of Los Angeles).

 

Where are the uploaded images stored in WordPress?

When you upload an image for a page or a post WordPress stores the image at the following location:

wp-content\uploads\YEAR\MONTH

where YEAR and MONTH are the year and month of the upload date.

wordpress image upload location

WordPress creates a new folder every month to reduce the number of files per folder. This way you can find your files easier and the server can also find the files faster, because it can work with a smaller list of directory entries.

How can I remove an image from the Uploaded Images list in WordPress?

When you upload an image as a theme header images the image will be stored in the Media library.

WordPress Theme Header Wrong Images

If you upload multiple header images and you want to remove some of them

  • Log into your WordPress site as an administrator,
  • On the left side select “Library” in the Media menu,

WordPress Media Library Select

  • Click the “Delete permanently” link next to the unwanted image

WordPress Media Library Delete

  • Click “OK” to confirm the deletion of the file.

WordPress Media Library Delete Confirm

How can I create a custom header image for the Witcher World theme in WordPress?

The Witcher World is a great theme and it is very easy to customize it. The original header image is beautiful, but if you want to display your custom header image you have to take some simple image editing steps to make sure it looks as good as the original.

The original image contains the left and right borders of the header, so if you add your image you have to add those to your custom image.

Create the custom header image

Click the image below to open the header image template with transparent areas for your custom image in a new tab of your web browser. On the new tab right click the image and select “Save image as…” (“Save picture as…” in Internet Explorer) and save the image to your computer. When it is done close  the new tab to return to this page.

Witcher World header transparent template

 

Select a picture on your computer that you want to use as the header image. The following steps show how to do it in Colrel Paintshop Pro XI. All other graphics editor programs should have similar feature to do the same.

  • To resize the image to 988 pixel wide select “Resize” in the Image menu

Paint Shop Pro Resize Select

  • Set the width to 988 pixels and check the “Lock aspect rato” to set the height automatically and avoid distortion, and click OK,

Paint Shop Pro Resize

  • In the View menu select “Zoom to 100%” to see the larger view of the image,

Paint Shop Pro Zoom To 100%

  • To crop the image to 988 wide  and 300 high on the left side select the crop icon and in the header enter 988 pixel width and 300 pixel height,

Paint Shop Pro Crop Select

  • Move the crop rectangle to the desired place and click the “Apply” button on the header,

Paint Shop Pro Crop

  • Set the background color to blue to enable the transparency during the paste of the template,

Paint Shop Pro Background Color Is Blue

  • Double click the background color indicator,

 Paint Shop Pro Background Color Select

    • Click the blue color and click OK,

Paint Shop Pro Background Color Blue

  • Open the Witcher_World_header_transparent_template.png in the same application,
  • In the Selections menu click “Select All”

PaintShopPro_SelectAll

  • In the Edit menu click “Copy”,

PaintShopPro_Copy

  • Switch to the cropped image by selecting the file in the Window menu,

Paint Shop Pro Window Menu

  • Paste the Witcher_World_header_transparent_template.png on top of it as a “Transparent selection” exactly on top of your cropped image,

Paint Shop Pro Paste Transparent Selection

  • Save the new composite image on your computer. Click Yes to allow Paint Shop Pro to merge the parts of the image.

PaintShopPro_SaveMerge

Upload the custom header image

  • Log into your WordPress site as administrator,
  • On the left side select “Appearance,” and “Header”,

WordPress Theme Header Change Select

  • On the middle pane in the Select Image section select “Choose File” under Choose an image from your computer,

WordPress_ThemeHeaderChangeChooseFile

  • Select the new file and click the Open button,

WordPress Theme Header Change Browse File

  • Click the “Upload” button on the page,

WordPress Theme Header Change Upload File

  • You can upload multiple images and select  “Random: Show a different image on each page” in the Uploaded Images section to display a different image at every page load.

WordPress Theme Header Change Random

  • Click the “Save Changes” button at the bottom of the page.

WordPress Theme Header Change Save Changes

How to set up WordPress in five minutes

It really takes five minutes to set up WordPress.

If your site is hosted by an other Internet  Service Provider the process can be slightly different than the steps below, but it should be similar enough to be relevant to your situation.

If your site is hosted by Winhost.com

  • Log into your Winhost control panel at www.winhost.com
    (
    When you set up your site they gave you a user name and you selected a password to access the account administration pages)
  • On the main menu select “Sites” to administer you web site

Winhost Sites Link

 

  • On the Site List select the “Manage” link next to your site

Winhost Sites Manage Link

  • On the Site Manager window select the “App Installer” icon

Winhost App Installer Link

  • In the list of applications scroll down to the bottom to WordPress and click

Winhost App Installer WordPress Install Link

 

  • Enter the name of the folder where you want to install WordPress,

Winhost App Installer WordPress Install FolderName

  • Write down the full “AppPath” you entered. That will be the address of your WordPress site,
  • Click the “Install Application” button,
  • The confirmation page appears, but don’t click the link of your application yet,

Winhost App Installer WordPress Install Success Message

  • For advanced users only:
    • Before you continue make a note of the WordPress version your provider offers. It is 3.5.  At the time of  the writing of this post the latest version of WordPress is 3.5.1, so later we will overwrite the Winhost version using an FTP client.,
  • First we have to set up the MySql database that WordPress will use to store the content of your site, so click the “Site Manager” link below the top menu,
  • The link will take you to the Site Tools page,

Winhost MySql Setup Link

  •  Click the “MySQL” icon to set up the MYSQL database,

Winhost MySQL Setup Add

  • Click the “Add” button to create the MySQL database,

Winhost MySQL Setup Create

  • Enter
    • a name for the database 
    • username
    • the size of the data that the user can use in the database (if WordPress is the only applications you want to connect to this database enter the maximum value into the Quota field)
  • Click the “Create” button,

Winhost MySql Setup Success Message

  • To see the connection details for the newly created database click the “Manage” link,

Winhost MySql Manage

  • Copy the connection details to a text file, because you will need to enter these values into the WordPress configuration form,
  • Click the “Edit” link to set the database password,

Winhost MySql Change Password

 

  • Open a new tab in your web browser and enter the address of your wordpress site. In our example it is YOURSITE.com/blog

WodrPress Setup Config File

  • WordPress will create the missing configuration file when you click the “Create a Configuration File” button,

WodrPress Setup Config File Lets Go

  • Click the “Let’s go!” button,

WodrPress Setup Config Enter Values

  • Enter the values that you saved earlier,
    • Database Name
    • User Name
    • Password
    • Enter the Database Server name to the “Database Host” field
  • Click the “Submit” button

WodrPress Setup Config Run Install

  • Click the “Run the Install” button to create the WordPress configuration file,

WodrPress Setup Config Site Values

  • Fill out the form and click the “Install WordPress” button,

WodrPress Setup Config Success Message

  • Done! Click the “Log in” button to open your site manager page.

 

How to set up VisualSVN Windows authentication

If you get the access to ‘…’ forbidden error message in an svn client most likely the Subversion server authentication is not set up correctly.

Users can access the VisualSVN repository using the Windows user accounts of the server. To set up the Windows user account authentication:

  • Install VisualSVN on the Windows server,
  • In the start menu select VisualSVN, VisualSVN Server Manager,
  • On the left side right click Repositories and select  “Create New Repository…”,
  • Enter a repository name, and check “Create default structure…”,

VisualSVN New Repository

  • Create user accounts for the VisualSVN users,
    • In the Start menu Right click the “Computer”,
    • Select “Manage”,
    • In the Configuration, Local Users and Groups section right click “Users” and select “New User…”,

Windows New User

    • Enter the user information and click “Create”,
  • Create a security group for the VisualSVN users,
    • In the Local Users and Groups section right click “Groups” and select “New Group…”,

Windows_NewGroup

    • Create a Security Group for the VisualSVN users, name it “VisualSVN Users”,
  • Add the users to the Security Group,
    • On the left side in the Local Users and Groups section left click “Groups”,
    • In the list of groups double click the “VisualSVN Users” Security Group,

Windows Group Add Users

    • Click the “Add…” button,
    • Enter the user name into the field on the popup window and click “OK”,
    • Click “OK” on the Security Grpoup property window to save the user list,
  • Set up VisualSVN to use the server’s Windows users and groups
    • In the start menu select VisualSVN, VisualSVN Server Manager,
    • On the left side right click “VisualSVN Server (Local)” and select “Properties”

VisualSVN Properties Select

    • On the Authentication tab select “Use Windows Authentication”and “Basic authentication”

VisualSVN_PropertiesAuthentication

  • Add the Windows Security Group to the VisualSVN
    • In the start menu select VisualSVN, VisualSVN Server Manager,
    • On the left side right click the repository and select “Properties”

VisualSVN Repository Properties Select

    • On the Properties window click “Add…” and enter “VisualSVN Users” to enable the Security Group members to access the repository and click “OK”,

VisualSVN Repository Properties

    • To allow the members to read and write the repository leave “Read /Write” checked at the bottom of the window,
    • Click “OK” to save the changes.