WordPress and Cpanel main domain

Last Cyber Friday 2014 I got chance to try namecheap hosting. Its shared hosting package that normally priced $9,88/year . The price is only for 1st year but worth to try since I only got it for $0,98. The price is very good but since people often neglect it I prefer to act vice versa. I’ll use this hosting package for my family blog.

Domain and Sub Domain

The blog itself consist from :

1. Main domain

2. 4 sub domain but my wife told me to only activate 3 sub domain.

Size

Size of family blog (main domain + all sub domain is around 500 MB) in zip format.

$ du -sh zip
508M    zip

Traffic

The traffic is not big :

– less than 100 uv (unique visitor) for main domain

– less than 1000 uv for all sub domain (my wife blog is more famous than my blog hahaha).

Preparation before migration

Nothing special since namecheap enable ssh account even for the smallest shared hosting which is good for me. I can save migration time by utilize ssh command 🙂 . To enable ssh just open ticket under hosting support and set the priority plus pin access to speed up their respond.

After ssh access granted my job is wget all compressed file from old hosting provider. (db file also included by using mysql backup wordpress plugin).

It took less than 30 minutes to download all files + db backup.

Create Database

namecheap_db

Next step is create database for main domain plus all sub domain.

Write down all information to notepad in this format :

Domainname : dbuser : dbpassword : dbname

Import Database

Import using ssh is easy. Using previous information the process is followed the format:

$mysql -udbuser -pdbpassword dbname < nameofsqlbackup.sql

wait for while and repeat for the rest of file.

Change DB information in wp-config.php

Next step is change database information inside wp-config.php for each directory (main domain and its sub domain).

Using nano wp-config.php is enough for most case.

File structure

In Cpanel everything public must be located in www or public_html folder. For my case where main domain registered as main domain for cpanel then I need to separate its content (main domain files) from sub domain files.

My plan is put the files in following structure :

Main Domain

/home/rasyxqow/www

Sub Domain

/home/rasyxqow/www/app

Since I already have existing blog ready to use in tar.gz format then unpacked into root directory is a must.

Special for main domain

$wget -c wordpress.org/latest.zip

$unzip latest.zip

those command will download latest wordpress version and extract zip file.

Next step is move the content of wordpress folder into cpanel root folder (public_html). File manager is in rescue.

cpanel_domain

Main focus of this step is move all content but wp-content folder. That special folder will be taken from extracted folder.

The action will result in public_html as seen on the picture.

cpanel_main_domain2

Move the rest (wp-content, .htaccess and wp-config.php)

$ mv wp-content /home/rasyxqow/www/
$ mv .htaccess /home/rasyxqow/www/
$ mv wp-config.php /home/rasyxqow/www/

Fix mx record

The last step need to ensure before changing ns record is set google apps record.

Measure utilization before set ns record pointing to this namecheap server.

cpanel_domain3

Change NS records

Yes, this is the real last step 🙂

Change ns record according to email welcome from namecheap.

NS1 : dns1.namecheaphosting.com

NS2 : dns2.namecheaphosting.com

cpanel_dns_namecheap

Confirm with intodns.com if you’re in doubt .

Thanks for reading and see you in other post 🙂

Update :

My file structure left an issue when all domain already met their nameserver changes.

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.

Log give me more information :

SoftException in Application.cpp:631: Directory “/home/rasyxqow/public_html/app” is writeable by group .

Quick fix for this case :

$chmod 755 app