Itamar
Itamar

Reputation: 45

.htaccess Rules Are Not Implemented

On amazon ec2 I've created a .htaccess file with the following rules :

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\.html$ /$1 [L,R=301] 


<Files /index.php>
    Order Allow,Deny
    Allow from all
</Files>

But I still can directly access /index.php file and the first rule is not implemented as well. First the file was located in the /www folder , once it didn't work I've moved it to /www/html , but it still does not seem to work properly.

I'd like to know how to solve this issue, thanks.

Upvotes: 0

Views: 58

Answers (1)

anubhava
anubhava

Reputation: 785176

Instead of Files you can use RewriteRule to block it:

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)\.html$ /$1 [L,R=301] 

RewriteRule (^|/)index\.php(/|$) - [F,NC] 

Upvotes: 1

Related Questions