Why am I getting this laravel url routing error in .htaccess?

 




http://localhost/example-app/

to

http://localhost/example-app/public

 

just simple create .htaccess on root laravel project and type this script

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




If you don't want to remove all files and folder from the public folder, then just copy .htaccess to your root directory and rename server.php to index.php and last one step is if all resource files in /public directory couldn't find and request URLs didn't work for using asset() helper. Then, you need to add public to your helpers.php file.
function asset($path, $secure = null)
{
    return app('url')->asset($path, $secure);
}

To

function asset($path, $secure = null)
{
    return app('url')->asset("public/".$path, $secure);
}

You will fine the helpers.php in vendor/laravel/framework/src/Illuminate/Foundation/helpers.php.

source : https://stackoverflow.com/questions/58230970/why-am-i-getting-this-laravel-url-routing-error-in-htaccess

How to fix Error: laravel.log could not be opened?

sudo chmod -R 777 storage