0
votes

I have uploaded my laravel files to a Godaddy shared hosting.

My folder structure is like so

/mediservices
    all-other-laravel-files-and-folders

/public_html
    public
       index.php

The content of the index.php in the public folder in public_html has been edited to point to the medsirvices folder like so -

22. require __DIR__.'/../../mediservices/bootstrap/autoload.php';
34. $app = require_once __DIR__.'/../../mediservices/bootstrap/app.php';

I have added the following to the .htaccess file in the public_html folder

<IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteCond %{REQUEST_URI} !^mediservices
 RewriteRule ^(.*)$ mediservices/$1 [L]
</IfModule>

I still get a 500 Internal Server Error when i go to the domain.

The full message is

Internal Server Error
The server encountered an internal error or misconfiguration and was 
unable to complete your request.

Please contact the server administrator at [email protected] 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.
1
What does the log say?sg3s
The cpanel log says - [Mon Jan 28 13:24:43.102582 2019] [autoindex:error] [pid 4023462:tid 140040887854848] [client 197.211.60.122:36767] AH01276: Cannot serve directory /home/xeppkm4zpvkc/public_html/: No matching DirectoryIndex (index.html.var,index.htm,index.html,index.xhtml,index.wml,index.perl,index.pl,index.plx,index.ppl,index.cgi,index.jsp,index.js,index.jp,index.php4,index.php3,index.php,index.phtml,index.shtml,default.htm,default.html,home.htm,index.php5,Default.html,Default.htm,home.html,welcome.html) found, and server-generated directory index forbidden by Options directiveJoshua Majebi
create one temp.php file in your root directory and try to run with some testing content.Pragna
I created an index.php file in the public_html folder and just echoed something and it worked well. I have moved the content of my public folder to directly to the public_html folder and still get 500 errorJoshua Majebi
try to create temp.php and run file like hostname/temp.php . If that file run then there will be issue in your laravel structure and not in any other settingsPragna

1 Answers

0
votes

Following the comments I can suggest the following. You need to make it clear if you want to serve the site under the domain root or under a folder on a domain.

Keep an eye on your logs, they tell you what the issue is. And make sure it actually is the same error, even a small change in details can give you more information.

Serve site under domain root

If you want to server your site/Laravel project under the domain root so on example.org/ it should be configured like the following.

# Contains  all other laravel files
mediservices/
  ...

public_html/ <webserver root> <laravel public dir>
  index.php
  .htaccess

Your reference to your bootstrap in index.php should be.

__DIR__ . '/../mediservices/bootstrap/autoload.php'

Your .htaccess file should not need rewrite rules, so you can likely remove that configuration.

Serve site under folder on domain

However if you wish to serve your project from the folder mediservices/ after the domain part in the URL, so like example.org/mediservices/, and redirect users to that folder, you can keep the .htaccess rewrite rules you have, but you'll have to move your Laravel public folder to the following:

# Contains  all other laravel files
mediservices/
  ...

public_html/ <webserver root>
  mediservices/ <laravel public dir>
    index.php
  .htaccess <should stay under the public_html/ folder>

The references you use in index.php should be as you had, which is the following.

__DIR__ . '/../../mediservices/bootstrap/autoload.php'