laravelnewbie laravelnewbie - 19 days ago 6
Apache Configuration Question

.htaccess <IfModule> Directive Causing Internal Error 500

I'm a newbie to laravel. I'm getting an internal error 500 when I go to mydomain.com.

My error log says:

[Sun Nov 20 22:04:48.310309 2016] [core:alert] [pid 364784:tid 140380089542400] [client 141.101.105.69:27886] /public_html/public/.htaccess: <IfModule> directive requires additional arguments


I found this thread which sounds like my problem; Laravel blank white screen

But I'm on shared hosting and do not have SSH access. How can I execute this fix on shared hosting?

Edit from comments: My /public_html/public/.htaccess file is:

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

RewriteEngine On

# Redirect Trailing Slashes If Not A Folder...
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)/$ /$1 [L,R=301]

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

# Handle Authorization Header
RewriteCond %{HTTP:Authorization} .
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
</IfModule>

Answer

It looks like you have a blank IfModule directive in your .htaccess. You need to update it to state which module it is querying for the existence of. See: http://httpd.apache.org/docs/2.4/mod/core.html#ifmodule

Or post your .htaccess for help.

For example, to define a block in your .htaccess that only applied if the php module is loaded on the server, you might use:

<IfModule mod_php5.c>

Alternatively, if it is the closing directive, then you are missing a forward slash and need to change it to:

</IfModule>

Ref: error 500 for .htaccess error Ref: http://serverfault.com/questions/257986/error-500-for-htaccess-error