I’ve running this combination on several Servers:
/.htaccess
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC]
RewriteRule (.*) http://%1/$1 [R=301,L]
RewriteRule ^$ /cms [R=301,L]
/cms/.htaccess (Directory of ModX)
RewriteEngine On
RewriteCond %{HTTP_HOST} ^www.(.+)$ [NC]
RewriteRule (.*) http://%1/$1 [R=301,L]
1. Windows Server 2003 --> IIS-Server (ISAPI_Rewrite)
2. Apache (Mod_Rewrite)
3. Apache 2.0 (Mod_Rewrite)
It deletes the WWW if it is set and route all Site-querys in the CMS-directory ...
For ISAPI_Rewrite I have to rename the ".htaccess" into "_htaccess" ...
-> It works perfect on all this servers I’ve tried it !