Problem loading page "404 not found Error" in Laravel Project - laravel

I have created a website that was working fine, but now I am getting 404 not found error.
The live url is glucolight.co.uk
The main page is loading but all other pages show 404 not found.
I have .htaccess file in public folder with below content
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
I have tried putting same .htacces in root, in that case i get 500 general error.
Any solution please.

Related

Laravel 8 Images of Subpages/Routes are not Loading

all the images of my Laravel 8 Subpages/Routes are not Loading. It seems like a misconfiguration of my .htaccess file in the public directory. I cant find whats causing the problem. All the Images on the Startpage/index Site load completily fine. The Site is running on a Apache2 Webserver in a Subdirectory "/blog".
Here is my .htaccess File from the public directory:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
RewriteBase /blog/
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>

Laravel Images , Javascript and Css 404 error

I have all the css,js and images in public folder
It give me 404 when I open the website.
Links
http://domain.test/js/bootstrap-autocomplete.js
Shows 404 error
if I try link with public' path it opens http://safwa_new.test/public/js/bootstrap-autocomplete.js`
I tried modifying the .htaccess file in the root folder
it is not working
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteCond %{REQUEST_FILENAME} -d
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule (.*) public/$1 [L]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Send Requests To Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
it is not working

Not Redirecting to 404 page with laravel give error if put wrong Url

Hy!
i'm using laravel 5.8 and when i put the wrong address in my url it give error
Trying to get property of non-object (View: C:\xampp\htdocs\cms\resources\views\post.blade.php)
url like
http://127.0.0.1:8000/lkfajds;
this is wrong url i put.
why this not back me to 404 page how can i do this
Want: i want to it redirect me to 404 page
Here htaccess
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews -Indexes
</IfModule>
RewriteEngine On
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} (.+)/$
RewriteRule ^ %1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
</IfModule>
You need to use firstOrFail() on the model so it can show you the 404 page.

403 Error and Browser Cache

We have a Laravel Application as Back-end running on a Linux Server.
Some times, when reloading the page, the server returns a 403 Error.
This problem is solved if I clear my Browser Cache, but less than 1 minute using the app, the 403 error appears again.
/public/.htaccess file:
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
DirectoryIndex index.php # This line does the trick
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}] </IfModule>
Any clue about it?

All page show 404 apart from index

Even /home is 404. I just start learning laravel, I don't know if I did something wrong.
After reinstall composer and created a new project the problem still
exist.
Xampp is running.
Here is the .htaccess in public:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]
# Handle Front Controller...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]
# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>
have you added Route::get(/home, HomeController#index); to your routes file?

Resources