Mobile app version of vmapp.org
Login or Join
Fox8124981

: 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

@Fox8124981

Posted in: #Dns #Domains #Subdomain #WebHosting

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?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Fox8124981

1 Comments

Sorted by latest first Latest Oldest Best

 

@Heady270

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]

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme