I'm having problems to rewrite the canonical URL with www to non-www in my domain. If I try www.example.com and I allways get #404. Here is all the information about the apache2 configuration.
This is all what I have checked:
/etc/apache2/sites-enabled/000-default.conf
<VirtualHost *:80>
ServerAdmin info@example.com
ServerName example.com
DocumentRoot /var/www/example.com
<Directory /var/www/example.com>
AllowOverride All
<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.example.com [NC]
RewriteRule ^(.*)$ http://example.com/$1 [L,R=301]
</IfModule>
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>
/etc/apache2/apache2.conf
.
.
.
<Directory />
Options FollowSymLinks
AllowOverride All
Require all denied
</Directory>
<Directory /usr/share>
AllowOverride None
Require all granted
</Directory>
<Directory /var/www/>
Options Indexes FollowSymLinks
AllowOverride All
Require all granted
</Directory>
.
.
.
and the last information phpinfo()
Any idea? Thanks!