www to non-www redirect problems

Hi,

I'm trying to redirect www to non-www versions of my Omeka site.

I've added the following to my .htaccess file:

RewriteCond %{HTTP_HOST} ^www\.cornishmemory.com$ [NC]
RewriteRule ^(.*)$ http://cornishmemory.com/$1 [R=301,L]

This sort of works, but URLs don't work as I'd hoped.

http://www.cornishmemory.com/item/ROS_016

should redirect to

http://cornishmemory.com/item/ROS_016

but it actually redirects to

http://cornishmemory.com/index.php/ROS_016

..which results in a 404 - /item is stripped from the URL and index.php is added.

Otherwise my .htaccess is Omeka's default.

Does anyone have any suggestions to fix this?

Thanks,

Tom

Where do you have those lines, above or below the "stock" rewrite rules?

Hi John,

Thanks for replying - they're below the rewrite rules.

What happens when you move them above, so this is the first rule rather than the last?

Aha - that works - so simple. Thank you!