Subdomain reroute to domain - laravel

I have created a web app using Laravel 8 and is hosted on Server A using domain name 'myapp.com'. I have applied a wildcard subdomain eg: 'myweb1.myapp.com' and 'myweb2.myapp.com' for one of the app features.
I then purchased a domain 'myweb1.com' from Server B which I intends to reroute it to 'myweb1.myapp.com'. How do I achieve this?
So, when 'myweb1.myapp.com' is entered the URL will reroute to 'myweb1.com'. And 'myweb1.myapp.com/product' will be 'myweb1.com/product'.
Do I need to change the nameservers for 'myweb1.com'? Do I need to change .htaccess for it? What if I only purchased a domain without a hosting which I can't edit .htaccess? Can I achieve this? And are there any specific term for I want to do?

you can do it with reverse proxy.
if your web server is nginx: https://stackoverflow.com/a/14352958/5987259
if your web server is apache: https://stackoverflow.com/a/52286695/5987259

Related

Nginx / Laravel multi tenancy SSL management

Working with a multi tenancy solution where users are to be allowed to set their custom domains - the solution works just fine. However, looking for suggestions on how to get the SSL installed on those custom domains and set them in Nginx so they are served via https route.
In theory, as soon as the user adds custom domain from the backend - SSL is to be installed once A record / CNAME is verified to be pointing correctly. We will be getting Letsencrypt SSL and need an approach on how to handle Ngnix config to provide SSL key to it can be served.
If anyone has produced a similar solution and can shed light on how to approach this, that will be great.
Thanks in advance.
You can solve it by manually issuing certificates using Let's Encrypt and then adding new NGINX config file for serving new domain
Or you can just switch from NGINX to Caddy and it will automatically do it for you! Also you could specify in your application route file a route for a domain whitelist check to prevent unauthenticated domain issues

Why is my Google domain not directing to https?

I deployed an app on Heroku and set up automatic SSL configuration. According to my Heroku, my app can be accessed via https. If I use that URL, the connection is indeed secure.
I added a Synthetic Recored in my google domain to point to this url. I also added a Custom Resource Record where the Name is www, Type is CNAME, and Data is my DNS Target for the app.
I can only connect securely when I use https://www.osrshub.com. If I use www.osrshub.com or osrshub.com, it is not secure. What am I doing wrong?
The comment from user2864740 is correct. I needed to update my front end to redirect to https.
Force SSL/HTTPS with mod_rewrite

How to redirect my naked domain to https://www.mywebsite.com with Google Domains and Heroku?

I host my website on heroku and my domain is managed by google domains.
I have successfully linked my domain to my heroku app. However, to go to my website, people are forced to type the exact domain www.mywebsite.com . If someone just type mywebsite.com there is an http error.
I'm searching on both google & heroku docs but i don't find anything related to this . All info i found are about subdomains.
Any idea for redirecting all http/www typo to my www.mywebsite.com ?
At the core, keep in mind that example.com and www.example.com are 2 different hosts that can resolve to different IPs. Your DNS settings at Google Domains handles this. Either direct both of them to Heroku or simply direct "www" to Heroku via the CNAME record that they give you and then use Google Domains forwarding feature to forward all non-www traffic to www.example.com.
In the Synthetic records, choose Subdomain forward, fill # in Subdomain, then www.yourdomain.com in the Destination URL, also choose Forward path and then ADD

Heroku redirect WWW to non WWW

I have an application on Heroku. This does not work with adding www at the beginning. Is there a way to make it work with www without using a custom domain? I want it to be on the herokuppapp subdomain but it should work with www.
No, if you use the free .herokuapp.com domain then that is ONLY accessible via appname.herokuapp.com - if you want to use www. then you have to be using a custom domain.

How to setup a root domain redirect for https with google domains

Using Google Domains, I've set up a synthetic record to redirect foo.com -> www.foo.com. Just like in this example:
https://support.google.com/domains/answer/6346300?hl=en
However, it doesn't seem to work with https://foo.com.
How do I configure it so that the subdomain forward works with https as well?
To give it more context, I'm mapping my custom domain to a heroku app, so I've set up a CNAME record for www.foo.com, and would like https://foo.com to be mapped to https://www.foo.com
Before providing any input please confirm if you are using any pointing service?
If http://foo.com is working whereas https://foo.com is not then you may need any service like pointDNS or cloudflare.

Resources