rewriteRule .htaccess not working properly
07:04 30 Jan 2017

I'm trying to do a RewriteRule in .htacess but it's not working and I don't know why. This is my code

RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.php -f
RewriteRule ^(.+?)/?$ $1.php [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME}.html -f
RewriteRule ^(.+?)/?$ $1.html [L]
Options +FollowSymLinks
RewriteCond %{HTTP_HOST} ^www\.(.*)
RewriteRule (.*) http://%1/$1/$2 [R=301,L]
RewriteRule ^agencia/agencia-marketing-digital-bh$ /agencia/section.php?id=$1 [L]

How it should work: User acess www.mysite.com/agencia-marketing-digital-bh.php and it should change to www.mysite.com/agencia/agencia-marketing-digital-bh.php

Can someone please tell me what I'm doing wrong?

.htaccess mod-rewrite