Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

teampoison's avatar

Change Laravel Server.php to index.php and show index.php code

I run one project on localhost it was run on localhost with php artisan server now i move it to hosting. when i run this with server.php file than its show forbidden error and when i transfr htaccess from public folder to main and chnage server.php to index.php its show me index.php on main domain. how i run this laravel code on server.

0 likes
1 reply
lbecket's avatar

You shouldn't have to mess with any of that. You will, however, need to make sure that you've properly configured the server.

To set up the server environment, make sure that you've got the necessary programs (PHP and its required extensions, composer, Apache/Nginx, etc.). You'll need to make sure that you've properly configured the .env file with the correct database credentials and other environment-specific information. You'll need to run composer install on the server to install all the required dependencies and, perhaps most relevant to what you're describing, configure the web server to point to the public folder as the root directory. Also make sure that the public folder has the correct file permissions.

Please or to participate in this conversation.