Forgot login?
   No account yet?
Tech Stuff Joomla Notes Pseudo sub-domains and Joomla
smaller text tool iconmedium text tool iconlarger text tool icon

Subdomains are a wonderful thing. They can make a long or difficult address to a section of your website easy to get to and easy to remember. The problem is that Joomla doesn't handle sub-domains well. This is because typical sub-domains point to sub-folders under the root directory. Joomla is a single directory web application meaning that it is it's own container. Everything executes from the index.php file in the root directory.

So if you wanted to have a subdirectory for your support section of your site, you would need to setup a whole new Joomla installation and its own database for that section of the site. Not too practical to say the least.

Now you may say that there are SEO extensions available for Joomla that handle this and you would be right, but I tend to build sites for other less tech skill folks and adding yet another extension to their administrative learning curve is just not as attactive as a setup and forget solution like this one.

Enter the redirect. If you have a cpanel hosting control panel or a control panel that allows redirects for your sub domains, then there is a neat little trick that you can use to create pseudo-sub-domains.

The first step is to create the section of your site that you want your sub-domain to point to. Next in Joomla 1.5.x you may want to turn on SEF. This isn't critical, but if you are considering it then you should make that decision and stick with it. From this point on you will reference your redirects by the SEF address or not. After you create the redirect and you change your mind about SEF, you will then have to change your redirect addresses by hand.

Next you will need to go into your cpanel or other control panel and create a subdomain. If your control panel application is like mine, you must specify a sub-directory for the sub-domain to point to. IMPORTANT! At this point you should set your sub-directory inside another un-referenced sub-directory! For example, create a redirects sub-directory and then set each subdirectory within that like support/ should be redirects/support. More on this below.

Next, create the redirect to the joomla page address in the subdomain redirect. For example you have a joomla address for support as 'index.php?option=com_content&view=article&id=54' or /support.html (in SEF mode) you will now set support.yourdomain.com -> index.php?option=com_content&view=article&id=54 in your cpanel subdomain redirect manager.

Now, the reason for setting your subdomain folder to something like /redirects/support/ is in Joomla SEF. If SEF is on and one of your SEF addresses matches its name, then you will get errors for submenu addresses. For example, if you have yourdomain.com/support.html as your SEF address and as the main level menu item you may want to create support.yourdomain.com that points to this address. Later if you create a submenu item called forum with the SEF address of yourdomain.com/support/forum.html you will get a file can't be found when trying to navigate to it.

This happens due to the sub-directory creation of /support/ when the sub-domain 'support' was created. When the address yourdomain.com/support/forums.html was called, the server looked for the file forum.html in the support folder instead of letting Joomla translate the address. That is why you want to make your main redirect folder set to something that you are not going to reference in your menu structure as an alias.

You may notice that setting your subdomain up like this will not keep the address past the first page. I have yet to find a way around this but since my first goal her was to create a simple address for the user, I don't care too much after the navagate away from that main page anyway.

You must be a registered member of Powderworks.net to post a comment. Please login or register for an account.
Thank you!

Joomla Notes

Powderworks.net Member Websites

Imagine IT Consulting
Member: ImagineIT
The Citrus Chronicles
Member: MagicBrad
The Site Artisan
Member: Andy
Wren's Nest B&B
Member: Judith
Sumner Appraisal Service
Member: Gina
Dilbert's Computer  Service
Member: Dilbert