Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel Shared Hosting .htaccess

I am trying to deploy a Laravel project onto a share hosting, I've managed to get most of the hard work done but I cannot strip off the /public directory without a Forbidden issue.

The website works and shows same pages for these links

  • www.mywebsite.com/test/index.php
  • www.mywebsite.com/test/public/

But without the /index.php It returns ->

Forbidden

You don't have permission to access /test/ on this server. 

Currently my .htaccess looks like the following.

<IfModule mod_rewrite.c>

    RewriteEngine On

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

</IfModule>

Any ideas?

like image 955
Brent Avatar asked Dec 20 '22 12:12

Brent


1 Answers

this is the magic script i use (add to the .htaccess in public_html)

<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule ^(.*)$ public/$1 [L]
</IfModule>
like image 54
The Billionaire Guy Avatar answered Dec 22 '22 03:12

The Billionaire Guy