jeudi 27 août 2015

.htaccess not working on EC2 AWS

My .htaccess:

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_URI} !^/maintenance\.php$
RewriteRule ^(.*)$ /maintenance.php [R=307,L]

On localhost it works - it redirects everything to /maintenance.php

On EC2 if I add junk to .htaccess it shows "Internal Server Error" otherwise it seems to ignore .htaccess. I've currently got the permissions for .htaccess set to 777.

I've edited: /etc/httpd/conf/httpd.conf

I changed

<Directory />
    AllowOverride none
    Require all denied
</Directory>

to

<Directory />
    AllowOverride All
    Require all granted
</Directory>

and

DocumentRoot "/var/www/html"

to

DocumentRoot "/var/www"

(in /var/www/html there is only one file - index.html and just contains a h1 with 404)

Below DocumentRoot "/var/www" there was this which I left alone:

<Directory "/var/www">
    #AllowOverride None
    AllowOverride All
    # Allow open access:
    Require all granted
</Directory>

I've tried the following:

/sbin/service httpd restart

apachectl restart

but I'm still having the problem. I read that the instance might need to be rebooted but I'd like to avoid that because some people's work would be lost who are using the website.




Aucun commentaire:

Enregistrer un commentaire