Home > Back-end >  Laravel project links Don't work on 000webhost.com after uploading
Laravel project links Don't work on 000webhost.com after uploading

Time:10-21

I managed to upload a blog test website to 000webhost.com.The links work on my machine but don't on the live server with the "Page Not Found - error 404" error message. Here is the site link: https://maherblog2021.000webhostapp.com/

How to fix the problem please ?

CodePudding user response:

I've solved the problem by putting the following .htaccess file in the public_html folder:

<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>

CodePudding user response:

It is probably because of htaccess. So for this you have to add htaccess file to your project root

  • Related