I can successfully direct DNS and Apache to map:
subdomain.site.com to site.com/folder in the public_html folder
but i cannot make this work:
subdomain.site.com to /system/user/templates/default_site/folder.group
any ideas? i get a 403 forbidden error if i try to map to a template group
thanks!
What you are trying to do, set a sub domain’s DocumentRoot to a template.group directory, will have undesired consequences.
The 403 error could be from a number of issues; possibly insufficient readability permissions for such a file/directory; or possibly from .htaccess configuration.
It is possible to do what you are describing, but you will not be accessing ExpressionEngine as you intend. The files located in template/*.group directories are static html files. That means, what you see is what you get. ExpressionEngine will not be initialized and no template language variables will be parsed.
Typically, all http requests are routed through the index.php file located in the main document root (public_html). This allows ExpressionEngine to setup the environment. Then, ExpressionEngine routes the URL request based on the URI string to the desired TemplateGroup/Template. Wherein template language parsing takes place and the magic happens.
If you truly desire the use of a sub domain, your best bet is to enable multiple sites. You do so by configuring a second index.php for which the sub domain’s document root uses as an endpoint. This process is described here.
In addition, some settings will need to be set in the config.php file if you wish for users to stay logged in across each site.
Lastly, content in ExpressionEngine is inherited from the parent site. So, enabling a second site for your desired sub domain will essentially created a blank new site.
For example, site_a (example.com
) has ID 1. And site site_b (subdomain.example.com
) has ID 2.
Channels are related to the site in which they are created. So are ChannelEntries, TemplateGroups and Templates. So if channel Blog is related to site ID 1, it will not be accessible from site 2.
Templates have a special exception because template-variables and template-partials can be placed in the global directory, making them accessible to site ID 1 and site ID 2.
The directory for global partials/variables looks something like:
…..continued in next comment… I guess there were too many links
My recommendation would be to avoid using multiple sites unless you really need to. The best solution is to simply access the template group normally, or by configuring a template-route with a single URI segment.
Packet Tide owns and develops ExpressionEngine. © Packet Tide, All Rights Reserved.