I have my website hosted on a CentOS server. When I add the .htaccess file it stops working showing "Internal Server Error".
On a side note: when I remove the .htaccess file the website works only with www.
I've checked and mod_rewrite is on and shared.
What can be wrong?
//Rewrite to www
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{HTTP_HOST} ^example.com[nc]
RewriteRule ^(.*)$ http://www.example.com/$1 [r=301,nc]
//Prevent viewing of .htaccess file
<Files .htaccess>
order allow,deny
deny from all
</Files>
//Prevent directory listings
Options All -Indexes