Laravel Helpers do not work in shared hosting production mode

0

I have a Laravel 5.6 application hosted on Ycorn, there, because it is shared, I do not have SSH access, which makes it very difficult to implement the framework .

With this, the helpers {{asset()}} and {{url()}} can not find my CSS, JS, etc. files. This is causing me a lot of headaches as the application does not work 100%.

But, for example, url() works for routes as well as route() , but to access files I have to do something like

href="url('public/images/'.$imagem)"

I have read that it can be .htacess , but I could not.

In the hosting the site is in the public_html folder, so I moved my files from the /public/ folder of Laravel to /public_html and set it to work.

Here is my .htaccess :

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

I have tried for RewriteBase co_de /public but nothing worked

    
asked by anonymous 19.07.2018 / 01:12

1 answer

0

Try to follow the guidelines for this link: link

Mostly the part below, so do not need to move your public to public_html:

  

8- Create a symbolic link to the public folder

     

Here's the real reason you need an SSH access to the hosting.   We need to tell the server that when the user accesses the folder   public_html (or www, or anything else), it actually   will access ~ / apps / yourite.com / public. For this, we will create a link   symbolic.

     

$ cd ~ & ln -s ~ / apps / yourite.com / public public_html Theoretically,   at this time your site should already be working correctly (A no   If you are in Locaweb, then you will probably have to see the   next step)

    
20.08.2018 / 16:28