Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Snapey's avatar

in your last post, you say

/home/somesharedaccount23424/public_html     (Web Root (public_html/www))

but you did not mention /www previously?

Laraertan's avatar

I thought I did Public_html is actually www folder!

Sorry for misunderstanding

There is no / there I was trying to explain

Web Root is public_html other word www

Snapey's avatar

Chrome says;

Resource interpreted as Stylesheet but transferred with MIME type text/html:

have you reviewed the actual response. is it the expected CSS?

Snapey's avatar

is there a .htaccess file in public_html?

Laraertan's avatar

Yes there is a .htaccess file in public_html

<IfModule mod_rewrite.c>

Options +FollowSymLinks
RewriteEngine On

AddType text/css .css

RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ index.php [L]


</IfModule>
Snapey's avatar

so that's going to send everything that does not exist to public_html/index.php

so /css/my.css will go to /index.php because there is no /css folder?

back to my original point, if all your public code for this site is in /app then the path should be /app/css/my.css

try temporarily renaming the .htaccess file in the root folder so that it is not involved

Laraertan's avatar

I renamed it and doesn't effect at all! Same as before!

Laraertan's avatar

The strange things is

If I create Main-app>public>css>my.css (this file empty css)

My Css file loading from public_html>app>css>my.css (there is a style and working)

Kind of mirror effect! But one of them empty

Snapey's avatar

sorry, I'm not sure I can be of any further help. clearly there is stuff going off not previously described that is screwing everything up, or your methods of testing and proving scenarios are not robust enough.

jlrdw's avatar

Without reading every one of those post you do realize you don't have to use the env file right? And by not using the env file the setup would be like version 4.2. But like I have said before some people will find a way to spend 10 hours to do a 15 minute thing. And remember there are other post on deploy have you searched for them?

Laraertan's avatar

Well after spend two days finally I found the problem.

inside server.php

17      if ($uri !== '/' && file_exists(__DIR__.'/../public_html/app'.$uri)) {
18          return false;
19      }
20      require_once __DIR__.'/../public_html/app/index.php';

I supposed to update also line 17

Now css loading as expected!

Laraertan's avatar

@jlrdw My solution not related to .env file I haven't see any doc covering server.php

Did you have similar problem?

Laraertan's avatar
Laraertan
OP
Best Answer
Level 1

I would like to share my experience in case someone gonna have similar problem!

This folder structure is suite for "Share Hosting". In case if you have more than one project

    1. Create folder name "Server"
    1. Inside Server folder Install Fresh L5 as "Main-app"
    1. Inside Server folder create new folder as "Public_html"
    1. Inside Main-app rename public as "app" and move into "Public_html" folder
|_/home/shareaccount        (Server folder)

    |_ Main-app
        |_  app
        |_  bootstrap
        |_ ...

    |_ Public_html          (www)
           |_app
                |_index.php
                |_img
                    |_logo.png
                |_css
                    |_master.css
    1. Create MyApp.php inside Main-app/app to extend Application.php
<?php 
namespace App;

class MyApp  extends \Illuminate\Foundation\Application
{
    public function publicPath()
   {
     return $this->basePath.DIRECTORY_SEPARATOR.'/../public_html/app';
  }
}
    1. Main-app/bootsrap/app use MyApp.php
    // $app = new Illuminate\Foundation\Application(
    //     realpath(__DIR__.'/../')
    // );

    $app = new App\MyApp(
        realpath(__DIR__.'/../')
    );
    1. Update server.php
if ($uri !== '/' && file_exists(__DIR__.'/../public_html/app'.$uri)) {
      return false;
}
require_once __DIR__.'/../public_html/app/index.php';
    1. Update index.php
require __DIR__.'/../../main-app/bootstrap/autoload.php';
$app = require_once __DIR__.'/../../main-app/bootstrap/app.php';

DONE!

Previous

Please or to participate in this conversation.