The easiest way is the correct way of doing it.
Change the document root to /public otherwise you need to reroute the requests in your htaccess file to /public. Search for my name and htaccess in the forum and you will find the one I use.
Oct 5, 2023
1
Level 1
Hosting Laravel Project (Images, Js, and CSS not showing)
I uploaded a laravel project ionos hosting. I added index.php and .htaccess files on root. index.html:
$uri = urldecode( parse_url($_SERVER['REQUEST_URI'], PHP_URL_PATH) );
if ($uri !== '/' && file_exists(DIR.'/public'.$uri)) { return false; }
require_once DIR.'/public/index.php';
and .htaccess file: <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]
But images, css, and js is not loading
When i add 'asset_url' => env('ASSET_URL'), in the config/app.php then it is showing otherwise it is not showing.
How can i fix it
Please or to participate in this conversation.