I have tested my Laravel 5 project on localhost its working fine with this url – http://localhost/project-name/public/
Then I uploaded my project on shared hosting, I have made desirable changes for database on .env file then trying to access it with the url – http://companysite.com/folder/innerFolder/public/
but not working and getting 500 internal server error
I have gone through with other questions with the related but no answer lead me to my solution. I have done following steps
- upload my project on root directory parallel to public_html
- update to project/public/index.php
- try to create subdomain pointing to my project but didn’t succeed
Internal Server Error
The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator at webmaster@techphant.techphant.com to inform them of the time this error occurred, and the actions you performed just before this error.
More information about this error may be available in the server error log.
Additionally, a 500 Internal Server Error error was encountered while trying to use an ErrorDocument to handle the request.
Advertisement
Answer
I have referred this link laravel.io
Finally, I did the job on my shared hosting. This is what I did
- Setup a project Laravel 5 in localhost correctly configured
- Double check the server configuration of PHP 5.4 (this because every little change on .htaccess file may change that config)
- Create a directory in the same level of public_html and put the project inside of that folder.
- Put the content of public (L5) directly on public_html (be aware of don’t overwrite the .htaccess file accidentally)
Now… This is the “tricky part”… I see this structure
perl5
php
public_html
[framework-folder]
ssl
Inside of public_html I can see all the files of public directory of Laravel 5 Go to index.php and edit the line 22
From this require __DIR__.’/../bootstrap/autoload.php’;
To this require __DIR__.’/../[framework-folder]/bootstrap/autoload.php’;
And the line 36
From this $app = require_once __DIR__.’/../bootstrap/app.php’;
To this $app = require_once __DIR__.’/../[framework-folder]/pulcro/bootstrap/app.php’;
The final step is to edit the .htaccess file and add some lines
RewriteEngine On # Redirect Trailing Slashes... RewriteCond %{REQUEST_URI} !^ RewriteRule ^(.*)$ /$1 [L]
and update [framework-folder]/server.php
From this require_once __DIR__.’/public/index.php’;
To this require_once __DIR__.’/public_html/index.php’;
Refresh the cache of my browser and.. Victory!! I know that this is not the absolute right way to install the framework (God, I never spoke about Composer) But… It’s working for me now Hope that this can help somebody in order to deploy Laravel 5