Knowledge Base

How can I run the Discussion Forums from a subdomain, such as forums.example.com?

You first need to have the subdomain setup with your host.  Then follow these simple steps to get it working:

1.  Open up /system/config.php and add the line

$conf['use_forum_url'] = 'y';

2.  Go into the ExpressionEngine Control Panel, click Modules, click Discussion Forum, click Forum Management, click Default Preferences.  Under General Settings, set the forum trigger word to “forums” and set the Forum URL to “http://forums.example.com”

3.  In your .htaccess set up a mod_rewrite to redirect the forums.example.com subdomain to the ‘forums’ trigger page:

RewriteEngine On
RewriteCond
%{HTTP_HOST} forums.example.com
RewriteCond
%{REQUEST_URI} !index.php
RewriteRule
^(.*)$ index.php/forums/$1

Note: If your host uses .htaccess to control subdomains (Engine Hosting is one such host), the above .htaccess rules should handle everything sufficiently.  Mapping the subdomain to a physical folder on your site in addition to this rule will cause Rewrite conflicts and not work properly.

Additionally, if you do not have mod_rewrite (Apache) or ISAPI_rewrite (IIS) on your server, you can use the standard method of running ExpressionEngine subdomains, however, you will have to run your forums through regular templates, which will increase the server overhead for running the forums.

If your host does not use .htaccess to control subdomains, and instead creates a new folder for each subdomain, then follow the directions on running ExpressionEngine subdomains instead of using .htaccess.  This does NOT require that you run your forum through the regular template engine.

If your website is running on cPanel, try the instructions at Getting a forum subdomain to work on cPanel instead.

Last Updated on Oct 21, 2007 at 18:46   ( Permalink )
Category: Modules, Discussion Forum