Redirection issue after deployment local to live server

Published 7 months ago by monum

Laravel is redirecting back to same page whenever i am hitting any post route like login or register, or contact forms.

Best Answer (As Selected By monum)
Snapey

ok, its not possible to login although I might have registered? The issue is that there are no session cookies being sent so the request to login etc comes in but cannot be linked to any previous activity.

arthurvillar

Sounds like the action on your <form> tag may be bringing you to the wrong route.

Can you show how your view file looks like? Also your LoginController if you have changed it in any way.

monum

I have already setup this project on localhost and it is working fine there. Then i have deployed it where i am facing this issue.

My Auth system is also not working whenever i am submitting the form. it redirect me at home page withot login.

/app/Http/Controllers/Auth/Logincontroller.php

Snapey
Snapey
7 months ago (995,795 XP)

have you checked permissions on the storage folder? It sounds like Laravel cannot create any session files

monum

Yes i have checked. there is not any problem in permission. and laravel is also creating files in session folder for each login.

"contact us" form is also not working. Its also redirecting on home without submitting the form. We don't need to login here.

Url is : http://www.xsdemo.com/requestbay/login

hanif-king

once check those permissions what @Snapey said. i wonder ! how smart you are? @Snapey

monum

I am sure about this . There is not any issue with file permission.

Would you please visit the site ? There you will find its redirect to home with every for every post route and sometimes with get routes also.

with a text "Redirecting to http://www.mysite.com".

hanif-king

Miss Monum your site is not redirecting to your home i checked it right now but i am sure there is no problem with your code but something is happing with your browser i think you may installed some browser Plugins recently or your PC (Terminal) has problem.

arukomp

I'm guessing http://www.xsdemo.com/requestbay is the home path to your Laravel app.

Don't forget to update APP_URL in your .env configuration so that router builds the correct URLs for you.

APP_URL="http://www.xsdemo.com/requestbay"
monum

@arukomp my .env file contains

APP_NAME=Requestbay APP_ENV=local APP_KEY=base64:n5rt9E0dQX/MFmAhPReC3BvtWC9pDyLIcmQ5v1sQiZI= APP_DEBUG=true APP_LOG_LEVEL=debug APP_URL=http://www.xsdemo.com/requestbay

monum

@hanif-king

I am Mr. Monu. :) I have already checked this site in more then on PC. and i have same issue with all PCs and browsers.

Is there any other solution?

monum

[HTTP/1.1 301 Moved Permanently 336ms]

This is the extra get request what i found in console of browser for live site. This line is not showing in localhost.

Is there any issue related this line?

Snapey
Snapey
7 months ago (995,795 XP)

Your pages work fine. I can access them all.

Unfortunately I can also access your .env file so I suggest you take the site down, change your app key and any exposed secrets

For instance, your database password is me******5$

You then need to consider how to correctly serve the site which does not include copying everything into one folder.

monum

Yes i know anyone can access by url. I will make it secure also.

And yes! I have to say, you are really expert in Laravel.

But for now i have to solve my redirecting issue. do you have any solution for this?

amoonu

Have you checked your middlewares.

amoonu

Maybe the controller handling your post routes has a middleware.

Please sign in or create an account to participate in this conversation.