- I want to deploy my Laravel 10 project to shared hosting securely, but could not find any secure way so, what did I do is I moved on files from public folder to my root directory like assets folder, .htaccess, and .env file, and the project is running fine. But I found out under laravel docs deployment section that https://laravel.com/docs/10.x/deployment#nginx
Please ensure, like the configuration below, your web server directs all requests to your application's public/index.php file. You should never attempt to move the index.php file to your project's root, as serving the application from the project root will expose many sensitive configuration files to the public Internet:
So now I am little worried what's the actual process is before in laravel 8 I used to use this code in my root htaccess and it was running good.
<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/ [L]
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^ server.php
2.But Laravel 10 doesnot have server.php. I tried to include this code into my Laravel 10 project's root htaccess also server.php along with public folder untouched, but the issue with it is that www.abc.com website doesnot loads but when I put www.abc.com/public the website loads. I dont want this, so i removed public folder and did what i have mentioned to my 1. part. Please suggest me a secure way of doing it.