Wildcard Subdomain Installation
The default installation method for Respond is AngularJS HTML5 mode. This works best for sites on a subdomain or root domain. This guide walks you through setting up wildcard subdomains so that you have your sites that you create automatically be mapped to a subdomain.
1. Enable vhost_alias module
If you followed the Digital Ocean installation, you can do this via the following command.
a2enmod vhost_alias service apache2 restart
See this thread for additional options to enable this module: Invalid Command VirtualDocumentRoot
2. Set a subdomain to *
This varies by DNS provider. But, typically you set the subdomain to * and URL Redirect it to a URL pointing at your server. If you use Namecheap, they provide a guide: How can I set up a catch-all (wildcard) subdomain?
3. Create a VirtualHost for your wildcard subdomains
If you followed the Digital Ocean setup, you can create your VirtualHost using the following code. The exact virtualhost setup for our demo site is shown below.
<VirtualHost *:80> ServerName responddemo.website ServerAlias *.responddemo.website ServerAdmin firstname.lastname@example.org VirtualDocumentRoot /var/www/html/responddemo/app/sites/%1/ </VirtualHost> # vim: syntax=apache ts=4 sw=4 sts=4 sr noet
I use a standalone domain for this purpose. I have found that trying to use the same domain as your app (or other subdomains) causes issues.