
How to setup a wildcard subdomain in QUICKCMS
Setting up a wildcard subdomain in QUICKCMS allows your website to respond to any subdomain (e.g., slug.yourdomain.com
) without needing individual configurations for each. This is particularly useful for dynamic product URLs in a SaaS environment. Follow these steps to configure wildcard subdomains in QUICKCMS:
1. Configure DNS Settings:
First, you'll need to create a wildcard DNS record to direct all subdomains to your server's IP address.
- Access Your DNS Management Panel: Log in to your domain registrar's control panel or wherever your DNS is managed.
- Add a Wildcard DNS Record: Create a new DNS record with the following details:
- Type: A (Address) Record
- Host or Value: *.yourdomain.com.
- Points to: [Your Server's IP Address]
This setup ensures that any subdomain (e.g.,
product1.yourdomain.com
,product2.yourdomain.com
) points to your server.
2. Configure Your Web Server:
Next, set up your web server to handle requests for these wildcard subdomains. The configuration steps depend on the web server software you're using.
For Apache:
- Edit the Apache Configuration File: Locate and open your Apache configuration file, typically found at
/etc/httpd/conf/httpd.conf
or/etc/apache2/sites-available/000-default.conf
. - Add a Virtual Host Entry: Insert the following configuration:
<VirtualHost *:80> ServerAlias *.yourdomain.com DocumentRoot /var/www/html </VirtualHost>
- ServerAlias: The
*.yourdomain.com
directive tells Apache to respond to all subdomains. - DocumentRoot: Ensure this points to the directory where your website's files are stored.
- ServerAlias: The
- Restart Apache: Apply the changes by restarting Apache:
bash sudo systemctl restart apache2
For Nginx:
- Edit the Nginx Configuration File: Open your Nginx configuration file, usually located at
/etc/nginx/nginx.conf
or within the/etc/nginx/sites-available/
directory. - Add a Server Block: Include the following configuration:
nginx server { listen 80; server_name *.yourdomain.com; root /var/www/html; }
- server_name: The
*.yourdomain.com
directive tells Nginx to handle requests for all subdomains. - root: Ensure this points to your website's root directory.
- server_name: The
- Restart Nginx: Apply the changes by restarting Nginx:
bash sudo systemctl restart nginx
3. Verify the Setup:
- Test Subdomains: Open a web browser and navigate to various subdomains (e.g.,
test.yourdomain.com
,demo.yourdomain.com
). They should all direct to your server's content as configured. - DNS Propagation: Remember that DNS changes can take up to 24-48 hours to propagate fully. If a subdomain doesn't resolve immediately, give it some time and verify your DNS settings.
Additional Considerations:
- SSL Certificates: If you plan to serve your site over HTTPS, consider obtaining a wildcard SSL certificate to cover all subdomains.
- Application Logic: Ensure your application can handle requests to various subdomains appropriately, especially if different subdomains should serve different content.
By following these steps, your server will be configured to handle wildcard subdomains effectively.