I am using htaccess to rewrite any www url to a non-www version
RewriteCond %{HTTPS} !=on
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
When I type domain.com/about
it works fine, however when I type www.domain.com/about
it changes the URL to domain.com/index.php?p=about
I have 'omitScriptNameInUrls' => true,
enabled.
I also have this in my .htaccess file
RewriteEngine On
# Send would-be 404 requests to Craft
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]
RewriteRule (.+) index.php?p=$1 [QSA,L]
What am I doing wrong here?
Edit: Here is the the vhost file.
<VirtualHost *:80>
ServerName domain.com
ServerAdmin [email protected]
DocumentRoot /var/www/
<Directory /var/www/>
Options Indexes FollowSymLinks MultiViews
AllowOverride All
Order allow,deny
allow from all
</Directory>
ErrorLog ${APACHE_LOG_DIR}/error.log
CustomLog ${APACHE_LOG_DIR}/access.log combined
</VirtualHost>