subdomains

Subdomains, Subdirectories, Redirects, Subpages, and Parked Domains

subdomainsURLs for a subdomain look like this: http://subdomain.maindomain.com.

Often, the subdomain is a separate website installed on the hosting panel of the main domainFor example, the primary website of the business Himalayan Connections is http://himalayanconnections.org, but a separate website for a specific program is installed on the subdomain http://gapyear.himalayanconnections.orgThis domain structure identifies the two websites and programs as belonging to the same organization. 

A subdomain that is a separate website redirects to a subdirectory on the main site. For example, http://subdomain.maindomain.com redirects to http://maindomain.com/subdomain/. The subdomain URL (http://subdomain.maindomain.com) can be maintained on all pages of the site by modifying the .htaccess file, and some other script (see below for tech details).

Alternatively, a subdomain may redirect to a subpage of the site (as opposed to a subdirectory). This is bit confusing, because the URL of a subdirectory is similar to the URL of a subpage. For example, on this site, the subpage https://www.highpeaksmedia.com/pricing/ shows a listing of subpages on the HPD website related to pricing; however, the subpage ‘pricing’ is not a subdirectory. A subdirectory refers to a file structure, whereas a subpage (or a  subfolder) represents a user-interface method to organize files – see Wikipedia on directories.

Addon domains are typically used to redirect a domain to another domain (or subdomain). After adding an addon domain, that domain should then be redicted, using wildcards. For more information, see:

To preserve SEO rankings on a redirect, make sure that the redirect is a permanent 301 Redirects (not a temporary 302 redirect or of some other variety). You can test the URL Redirect at SEO Logic’s URL Redirect Checker. Note that redirects set up on a sites registrar (e.g., at Namecheap) may be 302 Redirects, and not 301 Redirects. Redirects of parked domains, however (at least on Hostgator servers), are 301 Redirects.

A parked domain typically masks a main domain. For example, the website http://highpea5arketpro.com could be parked at http://eMarketingWisdom.com (note: it is not), and then used to show exactly the same content as http://eMarketingWisdom.com. However, masking is based on frames, which will not show the URL structure of the site (and possibly a few other features, such as the site favicon). Further, the masking will likely hurt the site ranking, because of the perception by the ranking algorithms of duplicate content (see Why Did I Turn Off Domain Masking? and How to Lose Rankings Using Redirects). See the Tech Note below, for masking of WordPress sites using domain parking.

Tech Notes – Masking of WordPress sites using parked domains

A parked domain is a registered domain, added as a parked domain via the configuration panel. On WordPress sites (because of the ‘mod_rewrite’ in the .htaccess file), masking is accomplished using an addon domain, with an index.html file (in the subdirectory of the addon domain) that creates an iframe to the main site (see Hostgator masked forwards and click here for masking instructions).

Tech Notes – Modifying the .htaccess file to maintain a subdomain URL

To maintain the URL directory structure of a subdomain, follow these steps (I think this will work, as there may be more than one way to skin the cat!):

On the WordPress dashboard > Settings > General menu, change the URL of the site to the format of http://subdomain.maindomain.com.

In the WordPress database, accessed via the phpMyAdmin option in the Cpanel on sites so-supported, edit the wp-options table with the URL (http://subdomain.maindomain.com) in two places: option id 1, and option id 36 (the second option is usually on page 2 of the folder).

Check the site to see if the URL structure is working.

It is possible that changes will be required to the .htaccess database (accessed via an FTP client or the FTP interface on the cPanel). Before modifying the file directly, try toggling the permalink structure to default and back (if it is not set there already), via the WordPress Dashboard > Settings > Permalinks.

If this doesn’t work, you may wish to try the following snippets of code in the .htaccess file (for details, see Hostgator’s Apache mod_rewrite and Examples, ‘Set a default home directory’)

# Set a default home directory, (this subfolder always loads)
# Replace ‘folder’ with your subfolder name
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^$ /folder/ [R=301,L] </IfModule>

Alternatively, we have used the structure

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

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply