Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

NoxxieNl's avatar

Domain A redirect to Domain B

Hiya guys,

I have a issues and I cannot to figure it out.

I have 2 domains running on the same nginx instance. (domaina.com, domainb.com)

domaina.com has SSL configured and running domainb.com does not

when I try to enter domainb.com it redirects (301) to domaina.com,

I have looked everywhere but I cannot figure out why this happens.

My second issue is, that with domaina.com the letsencrypt works for the non WWW variant but it gets a 400 response when its tries to request a request for the www version.

the DNS for www is set to CNAME with "@".

Does any of you guys have any idea to work out these two problems?

0 likes
5 replies
NoxxieNl's avatar

but both have there own server {} record in nginx.

frankielee's avatar

I have experienced the 301 error when I called the Laravel API, which only allows authenticated users to pass, else the users will redirect to the login site and will receive 301/302 if not enabling the "follow redirects" setting.

If you have the postman, you can call the API by disabled the Automatically follow redirects.

NoxxieNl's avatar

Ik looks like i found it, forge provision its sites to redirect all www trafic to the none www version.

Because of that lets encrypt cannot reach the www version.

However Firefox does not allow the redirect from www to non www when then www does not have a ssl certificate for it...

Kinda strange and dunno if it has anything to do with my server the provisioning or something else

Please or to participate in this conversation.