I am trying to redirect the index.php
to /
, at the Document root: /var/www/
by configuring the /etc/apache2/sites-enabled/000-default
file.
Using Ubuntu 14.04 Server with apache2.
These are the contents of the Directory directive at /etc/apache2/sites-available/000-default:
Options Indexes FollowSymLinks MultiViews AllowOverride None Require all granted
This is what I've tried from another question here:
<Directory "/var/www">
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Require all granted
RewriteCond %{THE_REQUEST} ^/index.php$
RewriteRule $(.*)^ / [R=301,L]
</Directory>
I've even tried this RewriteRule ^(.*)index\.(php|html?)$ /$1 [R=301,NC,L]
, and also RedirectMatch 301 ^/index.php$ http://www.example.com
(this time I removed, the RewriteCond
).
What happens
I can normally access my site from /
, but when I add /index.php
I get redirected to wwww.mydomain.com
(notice the 4 ws).
What am I doing wrong?