: How to display client's custom subdomain in the address bar? Let's say I have an online service for webmasters at example.com. My service presents a web app to be used by the visitors to the
Let's say I have an online service for webmasters at example.com. My service presents a web app to be used by the visitors to the websites owned by my webmaster clients. The web app lives at mywidget.example.com. Clients can create links to mywidget.example.com so their visitors can use the web app.
However, some clients will want to use their own custom subdomain to get to the web app. So, they can create a CNAME such as widget.clientdomain.tld and point it to mywidget.example.com. That works fine except visitors still see mywidget.example.com in the browser address bar instead of widget.clientdomain.tld.
What do I need to do to get client custom subdomains to appear in the visitor's address bar instead of mywidget.example.com?
More posts by @Fox8124981
1 Comments
Sorted by latest first Latest Oldest Best
Once your clients point the subdomains at your service, you need to configure your web server to use their subdomain rather than your own. You could use this rewrite rule in .htaccess to ensure that only the client subdomain will appear in the address bar. Other host names pointed to the service (including your own subdomain) will redirect:
RewriteCond %{HTTP_HOST} !^widget.clientdomain.tld [NC]
RewriteCond %{HTTP_HOST} !^$
RewriteRule ^/(.*) wiget.clientdomain.tld/ [L,R]
Terms of Use Create Support ticket Your support tickets Stock Market News! © vmapp.org2024 All Rights reserved.