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

Veltix's avatar

multiple subdomains on shared hosting.

I want link subdomain with subdomains.

I have laravel files in subdomain "api.mywebsite.com" and I want auth with api two different subdomains "customer.mywebsite.com" and "provider.mywebsite.com".

"api.mywebsite.com" - laravel files and working as RESTful api for auth logins, bookings, images and etc..

"customer.mywebsite.com" - where customer can login and see profile, make bookings and etc..

"provider.mywebsite.com" - where provider can login and see profile, accept bookings and etc..

Main subdomain will be "api.mywebsite.com" what share information to two subdomains..

Do I have do some configures in shared hosting? I don't have permissions to edit httpd.conf if I must change there something?

I want api shares auth info to customer website and provider website.

Any advice how to implement? one tutorial was with valet but this didnt work for me.

Do I have to add every subdomain a laravel files or only to api subdomain?

0 likes
5 replies
bobbybouwmann's avatar

Yes you can share sessions between subdomains. You just have to update your sessions.php file with the following

[
    'domain => '.mywebsite.com',
],
jove's avatar

@hakhsin RestAPI doesn't typically have sessions, they are sessionless. Did you add these routes in the api.php? If so they are by default without session.

1 like
hakhsin's avatar

Hi @jove, I have storage and api subdomains. I want to a login user can store file. But I get 403 error. How can I solve it? Every route in api subdomain work well.

bobbybouwmann's avatar

They all need to use the same way of authentication using a token for example.

1 like

Please or to participate in this conversation.