I have a problem after Uploading my Laravel project to shared hosting. Everything is ok when I test by Xampp(Localhost). But in production on shared hosting, I click "Submit button" on every Form-> It appears: `Page Expired. Although I have Csrf_token
and have searched many questions about my problem, I cannot resolve it. Please help me!!!
This is my form:
<form action="{{ route('login') }}" method="post" autocomplete="off">
@csrf
<div class="form-group">
<label for="nrp">NRP</label>
<input class="form-control @error('nrp') is-invalid @enderror" type="number" name="nrp" id="nrp" autofocus required>
@error('nrp')
<span class="invalid-feedback" role="alert">
<strong>NRP / Password yang dimasukan salah!</strong>
</span>
@enderror
</div>
<div class="form-group">
<label for="password">Password</label>
<input class="form-control" type="password" name="password" id="password" required>
@error('password')
<span class="invalid-feedback" role="alert">
<strong>{{ $message }}</strong>
</span>
@enderror
</div>
<div class="d-flex mb-5 mt-2 align-items-center">
<label class="control control--checkbox mb-0">
<span class="caption">Remember me</span>
<input type="checkbox" name="remember" />
<div class="control__indicator"></div>
</label>
<span class="ml-auto">
<a href="{{ route('user.register') }}" class="forgot-pass">Register Account</a>
</span>
</div>
<input type="submit" value="Log In" class="btn btn-block btn-primary">
</form>
The Route:
Auth::routes(['verify' => true]);
I’m using laravel/ui
for auth.
Please check the website for the example of the error http://etwpad.id/login
2
Answers
Try creating an application key.
Run
php artisan key:generate
. This will create a key and place it in your.env
file (APP_KEY
).Then
php artisan config:cache
. This will clear you cache for use of the new key.Could you please try to add
ob_start();
at the beginning of the index.php file in the root folder or public/index.php