简体   繁体   中英

Laravel - unable to find new page (404 error - not found)

I´m looking for solution for my laravel project problem (laravel version: 6.5.2). I found a lot of similar questions, but no solution.

So, I have created new laravel project and then i put it on my hosting.

My FTP structure is:

 - www
 - AutsokolaIS

In www folder, I copied content of Public folder and in the AutoskolaIS other folders and files (app, bootstrap, config, etc.)

Everything was good, until I tried to create a new page linked to welcome page.

Link is mydomain.com/page. After click on this link, I get 404 error page. When I directly open the URL mydomain.com/index.php/page everything works.

I know it´s problem with .htaccess file, but I´m not able to edit .htaccess file in correct form.

Can anyone please help me?

Thank you

By default the website will be load from public folder. If you want to remove public from your url,copy .htaccess file from public folder to root and replace the code with the following..

<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>

RewriteEngine On


RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ ^$1 [N]

RewriteCond %{REQUEST_URI} (\.\w+$) [NC]
RewriteRule ^(.*)$ public/$1 

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ server.php

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM