Skip to content

Cross-domain redirect

Sometimes you may want to redirect the user to a specific route on a different domain (than the current one). Let’s say you want to redirect a tenant to the home path on their domain after they sign up:

return redirect()->route('home')->domain($domain);

You can also use the tenant_route() helper to redirect users to another domain.

return redirect(tenant_route($domain, 'home'));

Enabling the feature

To enable this feature, uncomment the CrossDomainRedirect line in the features section of the tenancy config:

config/tenancy.php
'features' => [
// Stancl\Tenancy\Features\CrossDomainRedirect::class,
],