Reputation: 24116
I am installing Apache in CentOS 7 and this is my httpd.conf - http://pastebin.com/raw/YeiLn7GN
This is my document root: /home/host/public_html
To test if .htaccess
file works & if mod_rewrite
is enabled, I've uploaded the sample .htaccess
from a laravel project into /home/host/public_html/.htaccess
, which has the following contents:
<IfModule mod_rewrite.c>
<IfModule mod_negotiation.c>
Options -MultiViews
</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>
I then uploaded the following php script: /home/host/public_html/index.php
<?php echo '<pre>'; print_r($_SERVER); ?>
When I visit http://<my-server-ip>/index.php
, I get the following error:
500 Internal Server Error
I got found the following in /var/log/httpd/apache_error_log
file:
[Thu Dec 31 15:50:43.696465 2015] [core:alert] [pid 23807] [client xxx.xxx.xxx.xxx:56536] /home/host/public_html/.htaccess: Options not allowed here
If I remove the following lines from the .htaccess
file:
<IfModule mod_negotiation.c>
Options -MultiViews
</IfModule>
The script appears to load and no 500 error.
Any ideas what might be wrong?
Upvotes: 3
Views: 9887
Reputation: 1817
.htaccess: Options not allowed here error indicates that the htaccess file is not allowed to use the Options directive to change the settings.
To fix this error edit your apache config file /etc/httpd/conf/httpd.conf
:-
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride Options
Order allow,deny
allow from all
</Directory>
Adding "Options" to the AllowOverride list, will permit the use of Options directive in htaccess file
Upvotes: 2