My site is set up to not use the www.
Using the code in the documentation to remove the index.php works fine.
However, when I add the necessary rules to redirect the www to non-www and then go to a URL with the www in it, the index.php is always added.
So, http://mysite/blog works and the index.php is removed, but if I go to http://www.mysite/blog I am redirected to http://mysite/index.php/blog.
Here are the rules I am using:
<IfModule mod_rewrite.c>
RewriteEngine On
# Removes index.php
RewriteCond $1 !\.(gif|jpe?g|png)$ [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /index.php/$1 [L]
# If 404s, "No Input File" or every URL returns the same thing
# make it /index.php?/$1 above (add the question mark)
# Trying to remove www
RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
</IfModule>The www rewrite portion was taken from the HTML5 boilerplate.
Any pointers would be greatly appreciated, thanks.