Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Laravel get 500 internal server error

I had laravel project on share hosting, and my structure app is

/home/username

`->fontEndApps ( my laravel apps )`

`->backendApps ( my laravel apps )`

`->public_html`

in public html I put the index.php, htaccess and admin folder, in admin folder there is index.php and htaccess

backend is working fine but the front end when I try to access www.domain.com/segment1 or www.domain.com/segment1/segment2 I always got 500 internal server error, and this is my htaccess file for front end and back end

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options +FollowSymLinks
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

please help me to figure out this problem

like image 457
user3483754 Avatar asked Jun 16 '14 04:06

user3483754


3 Answers

Your problem is with .htaccess file. In goDaddy they wont set RewriteBase so you have to give it in your .htaccess file. The complete code would like this. This worked with my laravel portfolio site

 <Limit GET POST PUT DELETE>
#For REST support
       Allow from all
 </Limit>

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On
    RewriteBase / # <------------ This one you missed

    #Just to redirect to www.site.com when only site.com comes
     RewriteCond %{HTTP_HOST} !^www\. [NC]
     RewriteRule ^(.*)$ http://www.%{HTTP_HOST} [R=301,L]
    #end of codes

    # Redirect Trailing Slashes...
    RewriteRule ^(.*)/$ /$1 [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>
like image 87
Sanoob Avatar answered Oct 07 '22 14:10

Sanoob


After a couple of hours searching, this solved the problem:

Make sure index.php within /public_html has 644 permissions (mine was 664 and that was the cause of the Internal Server Error).

like image 33
ecairol Avatar answered Oct 07 '22 15:10

ecairol


I must comment this lines in .htaccess and it works:

#<IfModule mod_negotiation.c>
#    Options -MultiViews
#</IfModule>
like image 27
Manic Depression Avatar answered Oct 07 '22 14:10

Manic Depression