Don't do it. You will find that you can just open the .env file in the browser.
Oct 13, 2019
11
Level 1
How to deploy laravel on shared hosting properly
I'm trying to deploy a laravel project on shared hosting. Everything goes well but there is problem with htaccess configurations.. both / and /public shows homepage. And sometimes sessions losts
Here is public_html/.htaccess file
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} -d [OR]
RewriteCond %{REQUEST_FILENAME} -f
RewriteRule ^ ^ [N]
RewriteCond %{REQUEST_URI} (\.\w+$) [NC]
RewriteRule ^(.*)$ public/
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ server.php
RewriteCond %{SERVER_NAME} !^www\.
RewriteRule ^(.*)$ https://www.%{SERVER_NAME}%{REQUEST_URI} [L,R]
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]
</IfModule>
What is my mistake here ?
Level 122
I mean don't put the whole project in the published folder of your hosting provider.
Some of your project should be private. You can usually put everything above the folder that the host says put your code in, and then copy the public folder to public_html or htdocs
Please or to participate in this conversation.