Adding a Subdomain for a Page on Your WordPress Website
Do you want to have a page on your WordPress website with it’s own subdomain? You’ve come to the right place. Here is a video tutorial showing you how to accomplish just that. This video is for professional web designers and not the faint of heart!
Wondering what is a domain name?
You might use this to create landing pages or demo pages on your website. Click here to download the file (you will need to unzip the file before uploading) or copy the code below:
/**
* Front to the WordPress application. This file doesn't do anything, but loads
* wp-blog-header.php which does and tells WordPress to load the theme.
*
* @package WordPress
*/
/**
* Tells WordPress to load the WordPress theme and output it.
*
* @var bool
*/
$_GET['page_id']=4323;
define(‘WP_USE_THEMES’, true);
/** Loads the WordPress Environment and Template */
require(‘../wp-blog-header.php’);
How to add a subdomain to a WordPress page instructions:
If you prefer to read the How-To instead of watching the video, here are the steps:
- Create your page on your WordPress site by logging into your Dashboard and going to Pages>Add New.
- Type in a title and add content to your page. Then, click “Publish.”
- Log into your hosting account and navigate to Subdomains. Depending on your host, it might be under Domains or Hosting. Use your host’s search or help section, if you can’t find it.
- Add a subdomain that points to a subdirectory. HINT: Only use lower case letters and numbers for both the subdomain name and subdirectory.
- Now, go to the File Manager on your hosting account, and click on the subdirectory that was created when you added the subdomain.
- Copy the code above for the file called index.php. Open Notepad or any text editor and paste the code into it.
- Type in the ID of your new page in the file where it says: $_GET[‘page_id’]=4323; Note: You need to replace the number shown in bold with the ID of your new page. You can find the ID of your page by hovering over the Edit button while editing your page. Look in the lower left corner of your screen to see the URL, which includes post=ID.
- Save the file on your computer with file name as index.php. You may need to select a different file type, so you don’t accidentally save the file as index.php.txt.
- Back in the File Manager on your hosting account, make sure you are in the subdirectory which the subdomain points to and click Upload. Browse to the file you saved on your computer and upload it to the subdirectory.
Read more about the WordPress platform and why it’s the best.