Here what I have now in my .htaccess, I’m not sure that it possible to replace all that with nginx rewrite, as far as I can understand I can fix 1st part (redirect all users to 'www.' prefix), but other are really hard to migrate.
Code:
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteCond %{HTTP_HOST} ^site1\.com$ [NC]
RewriteRule ^(.*)$ http://www.site1.com/$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^site2\.com$ [NC]
RewriteRule ^(.*)$ http://www.site1.com/$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^site4\.com$ [NC]
RewriteRule ^(.*)$ http://www.site1.com/$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^site3\.com$ [NC]
RewriteRule ^(.*)$ http://www.site1.com/$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^www\.site2\.com$ [NC]
RewriteRule ^(.*)$ http://www.site1.com/$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^www\.site3\.com$ [NC]
RewriteRule ^(.*)$ http://www.site1.com/$1 [L,R=301]
RewriteCond %{HTTP_HOST} ^www\.site4\.com$ [NC]
RewriteRule ^(.*)$ http://www.site1.com/$1 [L,R=301]
### BOOST START ###
AddDefaultCharset utf-8
<FilesMatch "(\.html|\.xml|\.json)$">
<IfModule mod_headers.c>
Header set Expires "Sun, 19 Nov 1978 05:00:00 GMT"
Header set Cache-Control "no-store, no-cache, must-revalidate, post-check=0, pre-check=0"
</IfModule>
</FilesMatch>
<IfModule mod_mime.c>
AddCharset utf-8 .html
AddCharset utf-8 .xml
AddCharset utf-8 .css
AddCharset utf-8 .js
AddCharset utf-8 .json
</IfModule>
<FilesMatch "(\.html)$">
ForceType text/html
</FilesMatch>
<FilesMatch "(\.xml)$">
ForceType text/xml
</FilesMatch>
<FilesMatch "(\.json|\.js)$">
ForceType text/javascript
</FilesMatch>
<FilesMatch "(\.css)$">
ForceType text/css
</FilesMatch>
# NORMAL - Cached css & js files
RewriteCond %{DOCUMENT_ROOT}/cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.css -s
RewriteRule .* cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.css [L,QSA,T=text/css]
RewriteCond %{DOCUMENT_ROOT}/cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.js -s
RewriteRule .* cache/perm/%{SERVER_NAME}%{REQUEST_URI}_\.js [L,QSA,T=text/javascript]
# Caching for anonymous users
# Skip boost IF not get request OR uri has wrong dir OR cookie is set OR request came from this server OR https request
RewriteCond %{REQUEST_METHOD} !^(GET|HEAD)$ [OR]
RewriteCond %{REQUEST_URI} (^/(admin|cache|misc|modules|sites|system|openid|themes|node/add))|(/(comment/reply|edit|user|user/(login|password|register))$) [OR]
RewriteCond %{HTTP_COOKIE} DRUPAL_UID [OR]
RewriteCond %{HTTP:Pragma} no-cache [OR]
RewriteCond %{HTTP:Cache-Control} no-cache [OR]
RewriteCond %{HTTPS} on
RewriteRule .* - [S=3]
# NORMAL
RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html -s
RewriteRule .* cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.html [L,T=text/html]
RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.xml -s
RewriteRule .* cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.xml [L,T=text/xml]
RewriteCond %{DOCUMENT_ROOT}/cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.json -s
RewriteRule .* cache/normal/%{SERVER_NAME}%{REQUEST_URI}_%{QUERY_STRING}\.json [L,T=text/javascript]
### BOOST END ###
# Rewrite URLs of the form 'x' to the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !=/favicon.ico
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
RedirectMatch ^/contribut-missing-images$ /forums/showthread.php?t=67
RedirectMatch ^/user/password$ /forums/login.php?do=lostpw
RedirectMatch ^/user/(.*)$ /profile.php
RedirectMatch ^/users/(.*)$ /profile.php
RedirectMatch ^/messages$ http://www.site1.com/forums/private.php
#
# Externally redirect direct client requests for "/index.htm" to "/" in
# canonical domain (This applies to /index pages in any directory)
RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /([^/]+/)*index\.htm\ HTTP/
RewriteRule ^(([^/]+/)*)index\.htm$ http://www.site1.com/$1 [R=301,L]
#
# Externally redirect to remove multiple contiguous slashes at beginning or end of URL
RewriteCond %{REQUEST_URI} ^//+(.*)$ [OR]
RewriteCond %{REQUEST_URI} ^(.*/)/+$
RewriteRule / http://www.site1.com/%1 [R=301,L]
#
# Externally redirect to remove multiple contiguous slashes embedded in URL
RewriteCond %{REQUEST_URI} ^/([^/]+)//+(.*)$
RewriteRule // http://www.site1.com/%1/%2 [R=301,L]
</IfModule>