Digital Marketing

Subdomains and WordPress – ‘How To’

This article is the result of some recent work done on a new website and I have written it as a step by step solution. It could save you a heap of time. It is assumed that you understand the use of FTP.

OBJECTIVE 1: Create a website and add a subdomain.

Please note: The domain, subdirectories, and files in this article are imaginary and are for instructional purposes only.

Let’s use the example of a fruit grower.

Create a fruit.com website using your FTP client software and with the files and subdirectories as follows:

  • fruit.com/index.html
  • fruit.com/apples/orchard.html
  • fruit.com/grapes/vineyard.html

Where fruit.com is usually represented by /public_html/ on the server and index.html is the home page.

SUBDOMAIN

Use the cpanel utility to ‘add’ a subdomain – citrus.

This means it will create a new folder ‘citrus’ which is a SPECIAL FOLDER.

Using FTP again with the username and password as before (i.e. don’t create a new FTP user for the subdomain), create:

  • /public_html/citrus/index.html (and this time it’s a different index.html)
  • /public_html/citrus/oranges/grove.html
  • /public_html/citrus/grapefruit/orchard.html

To access index.html, grove.html, and orchard.html using your browser, the URLs are:

  • citrus.fruta.com/index.html
  • citrus.fruta.com/ Naranjas/arboleda.html
  • citrus.fruta.com/pomelo/huerto.html

If everything is set up correctly, the following will NOT show the new index.html, or grove.html, or orchard.html

  • fruit.com/citrus/index.html
  • fruit.com/citrus/oranges/grove.html
  • fruit.com/citrus/grapefruit/orchard.html

Conclusion: Designating the ‘citrus’ folder as a subdomain has made it special. It’s special because you have to access the folder in a special way. It’s not special in the way it uses FTP to add content.

WORDPRESS (abbreviated ‘WP’)

OBJECTIVE 2: Install WP on the fruit.com site, and then on the ‘citrus’ subdomain.

(See WordPress.org for installation method)

On your main site –

Using cpanel’s MySql database management utility, create a database, say, ‘wp’. Your actual full name that you will see will turn out to be ‘yourwp_username’.

Create a new user, say, ‘wpu’. Your actual full name will turn out to be ‘yourusername_wpu’.

Connect the new user to the new database.

The actual names will be the ones you’ll use in your WP installation when you edit your wp_config file (the ‘wp_’ here has nothing to do with the name you gave your database).

Using FTP, install WP, following the installation method, on your main fruit.com site. You’ll probably install it to /public_html/, or something like /public_html/blog/

Now for WP on your subdomain –

Using cpanel’s MySql database management utility, create a database, say, ‘ws’. Your real name will turn out to be ‘yourusername_ws’.

Create a new user, for example ‘wsu’. Your real name will turn out to be ‘yourusername_wsu’.

Connect the new user to the new database.

The actual names will be what you will use in your WP installation when you edit your wp_config.

Using FTP install WP, following the installation method, in your ‘citrus’ folder. You’ll probably install it to /public_html/citrus/, or something like /public_html/citrus/blog/

Well done! You now have a working subdomain with WordPress installed on both the main domain and the subdomain.

Leave a Reply

Your email address will not be published. Required fields are marked *