Thread:Project:Support desk/non-www redirect for mediawiki/reply (2)

It's much simpler to do this with ModAlias, and has better performance.

http://httpd.apache.org/docs/2.4/mod/mod_alias.html#redirectpermanent

Put that directive inside a vhost section targetting www.site.com, and define a different vhost for site.com where the normal rewrite rules for the wiki apply.

Also, be sure to update $wgServer, otherwise you'll have problems with forms (editing, searches, preferences) if they're pointing to www.site.com.