Tommy001
6 months ago
1160
12
Assistance

.htaccess problem – fonts not found in public folder

Posted 6 months ago by Tommy001

I have my Laravel site in a subfolder in the public_html folder. The setup is like this:

public_html
    laravel_folder
        app
        bootstrap
        config
        database
        nbproject
        node_modules
        public
            css
            fonts
                vendor
                    font-awesome
        and so on...

I have 2 problems, that I think depend on the same thing. Fonts that exist in the public folder are not found (404) and the URLs are for ex shown like this:

www.example.com/laravel_folder/public/recipes 

...with the laravel installation folder and public folder always visible in the URL. So I am thinking that this is a .htaccess problem. This is what I have so far in .htaccess in the public_html folder:

<IfModule mod_rewrite.c>

    Options +FollowSymLinks

    RewriteEngine On
    RedirectMatch ^/$ /cookbook/public/

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

And this is the .htaccess in the Laravel installation folder:

<IfModule mod_rewrite.c>
    RewriteEngine On
   RewriteCond %{REQUEST_URI} !^public
   RewriteRule ^(.*)$ public/ [L]
</IfModule>

...and in the public folder:

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

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

Can somebody see what I should alter, to get rid of /laravel_folder/public/ in the URLs? I guess that my missing fonts also depends on this same issue. They exist in the public folder but cannot be found.

Please sign in or create an account to participate in this conversation.