Point multiple domains to one website

I have a Laravel app that works with multiple domains. First siteA.mydomain.com is a user website and then is siteB.mydomain.com that serves the REST API. In my old server I had only one Laravel app and siteA and siteB subdomains pointing to it.

Now I wanted to host my app on Dreamhost Shared hosting and I tried to upload te app to one website, and then mirroring another domain to that website, but it didn’t work.

I’ve tried this so far:

  1. Domain mirroring (Hosting my app with siteA as subdomain and mirroring siteB to siteA)
  2. Making another website for siteB and then changing the web location to be the same as siteB.

I thought the latest would work, but the non https siteB just redirected me to siteA, and https returned a 404 error page.

Anyone knows any workaround to this? The app is already installed and running on siteA, hosted on dreamhost. But I had to clone the laravel app and hosted in another server with siteB subdomain.

Thanks for your answers!

I have non-Laravel websites setup as described in #2, and they work as expected – siteA and siteB are independent sites but show the same content, HTTP-HTTPS redirects work, etc.

Is it possible that Laravel’s routing is causing the odd redirects? Or .htaccess rules? To tease the issue apart, you might try creating a static test file (test.txt) and try URLs like: http://siteA.mydomain.com/test.txt

[ Note: I’ve only ever played with Laravel, so not an expert ]

I think my config is broken because of the first mirrored setup. Even when I removed siteB from my websites, and created it again, I still get redirected to siteA when acessing HTTP and site not found on HTTPS. I’m currently talking to support to figure that out.

1 Like

Ok, so I think my apache config is kinda “hard coded” to point to a certain folder. Both times I’ve talked to support they manually change the website folder location on the Apache config. I try the same as habilis (have a txt file on the other site to check if I can see it) and even after I changed the website folder on the domain config, I still get the same page the support guy configured.

I’ve asked support if they can allow me to change the folder location whenever I want but I still haven’t got an answer.

Also, I’m writing all of this if anyone have the same problem.

This is the response I got:

“The https service should update when you change it, however since you
are on the newest PHP version (8.0) and it is brand new, our Network
Engineers are still working with it, I think this might be part of the
cause why it is not updating. Normally to correct this issue you can
remove the SSL to disable the https service and add it back which will
correct it. However I see that is not working on this domain, so I am
going to check with our dev team on this issue. I will be leaving your
support ticket open and moving it to my personal queue so I can follow up
as soon as I hear back from them”.

So it seems to be a problem with php 8.0 and also my domain (maybe because of the mirroring?). I asked in the chat if I could switch to 7.4, change the folder and then change it back to 8.0, they told me it might work, but that I should wait until they figure out my issue first.

Ok so this is how I fixed it (I already have an app configured with a domain):

  1. Remove SSL of the domain you want to point to the existing app, and wait for changes to propagate (might be useful to clear browser cache)
  2. After checking that HTTPS is removed, point the domain to the user and directory of the already existing app (dont move any files!!).
  3. After checking that your domain is pointed, re-order an SSL certificate and wait for it to apply.

Now your domain is pointed to an already existing app.

1 Like

This topic was automatically closed 60 minutes after the last reply. New replies are no longer allowed.