How to fix redirecting to subdomains that are on different servers?

Asked

Viewed 18 times

1

I am working on an Arabic api that when they access the url of the api by the browser the user is redirected to the front-end. the problem is that the url of fron-end is concatenated with the url of the back-end, breaking the link, thus: https://base-url.com.brhttps://domino.com.br

The problem started when I changed an environment variable that stores the font url.

Route::any('/', function () {
     header('Location: ' . env('APP_FRONTEND_URL'));
     die;
});

How can I correct that? Is it because both projects are in different areas?

2 answers

1

The Laravel has several helpers to avoid sending HTTP headers manually. For redirecting you can use the function redirect (attention to return):

Route::any('/', function() {
    return redirect('https://exemplo.com.br');
});

0

Browser other questions tagged

You are not signed in. Login or sign up in order to post.