.htaccesshttp-redirectlaraveldirectorypublic

How to redirect to public folder on laravel


I have this structure:

My domain: www.example.com

and this is my laravel's project folder: http://www.example.com/project

and I would like to redirect to http://www.example.com/project/public

I know this answer has been answered before but I try to implement it and not work for me.

Sorry for my english, I just speak spanish


Solution

  • For htaccess

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^example.com$ [NC,OR]
    RewriteCond %{HTTP_HOST} ^www.example.com$
    RewriteCond %{REQUEST_URI} !project/public/
    RewriteRule (.*) /project/public/$1 [L]
    

    Put it into your public_html/ or www/ folder where is the root of example.com/