another htaccess rewrite help.

darvil nginx-forum at nginx.us
Fri Jan 8 14:21:36 MSK 2010


Hey guys.

I posted this on WHT but I didn't get the help I wanted.  I'm helping someone move their site to nginx but they have some htaccess that I don't know how to convert.  I've done the easy rewrites but when it comes to the Cond statements I don't know how to convert.  I would really appreciate if you guys can help me.  I'm doing this for a Russian site (ironically enough).

Original .htacess


AddDefaultCharset windows-1251
RewriteEngine on
RewriteCond %{HTTP_HOST} ^blahblah\.com
RewriteRule ^(.*)$ http://www.blahblah.com/$1 


#flash card dat
RewriteRule ^8_marta.html$ public/8_marta.php 

#RewriteRule ^public/css/(.*)$ http://blahblah.cachefly.net/public/css/$1 
#RewriteRule ^public/js/new_js/(.*)$ http://blahblah.cachefly.net/public/js/new_js/$1 
#RewriteRule ^public/images/(.*)$ http://blahblah.cachefly.net/public/images/$1 

RewriteRule ^index.html$ public/index.html 
RewriteRule ^fcard_data.xml$ system_functions/get_flash_card_slides_xml 
RewriteRule ^fcard_data_(.*)\.xml$ system_functions/get_flash_card_slides_xml/$1 
RewriteRule ^fcard_user_pic_(.*)\.xml$ system_functions/get_flash_card_xml_with_user_pic/$1 
RewriteRule ^session_(.*)\.xml$ flash_cards/temp/session_$1.xml 
RewriteRule ^saved_(.*)\.xml$ flash_cards/saved/$1.xml 
RewriteRule ^(.*)cloud_data\.xml$ system_functions/get_cloud_xml 
RewriteRule ^site_map.html$ site_map 
RewriteRule ^sms_test/zero.htm$ zero.htm 
#flash templates
RewriteRule ^(.*)_shablon_(.*)\.swf$ $1.swf 


RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)\.html$ pages/$1.html 
RewriteRule ^(.*)\.gz$ $1.gz 


RewriteCond $1 !^(index\.php|public|music|temp|video|images|img|clipart|cat_ico|pages|pictures|cast_stone|artcl|banners|vc|mobile|mobile_cards|phpMA2|myphpadmin3|fla sh_cards|flash_user|captcha|pcards|server.swf|client.swf|help.swf|user_faces|bots.txt|favicon\.ico|update\.php|yandex_57de7ec45e87f775.txt)

RewriteRule ^(.*)$ index.php/$1 


What I've done so far.


AddDefaultCharset windows-1251
RewriteEngine on
RewriteCond %{HTTP_HOST} ^blahblah\.com

rewrite ^/(.*)$ http://www.blahblah.com/$1 last;

#flash card dat
rewrite ^/8_marta.html$ public/8_marta.php last;

#RewriteRule ^/public/css/(.*)$ http://blahblah.cachefly.net/public/css/$1 last;
#RewriteRule ^/public/js/new_js/(.*)$ http://blahblah.cachefly.net/public/js/new_js/$1 last;
#RewriteRule ^/public/images/(.*)$ http://blahblah.cachefly.net/public/images/$1 last;

rewrite ^/index.html$ public/index.html last;
rewrite ^/fcard_data.xml$ system_functions/get_flash_card_slides_xml last;
rewrite ^/fcard_data_(.*)\.xml$ system_functions/get_flash_card_slides_xml/$1 last;
rewrite ^/fcard_user_pic_(.*)\.xml$ system_functions/get_flash_card_xml_with_user_pic/$1 last;
rewrite ^/session_(.*)\.xml$ flash_cards/temp/session_$1.xml last;
rewrite ^/saved_(.*)\.xml$ flash_cards/saved/$1.xml last;
rewrite ^/(.*)cloud_data\.xml$ system_functions/get_cloud_xml last;
rewrite ^/site_map.html$ site_map last;
rewrite ^/sms_test/zero.htm$ zero.htm last;

#flash templates
rewrite ^/(.*)_shablon_(.*)\.swf$ $1.swf last;


RewriteCond %{REQUEST_FILENAME} !-f
rewrite ^/(.*)\.html$ pages/$1.html last;
rewrite ^/(.*)\.gz$ $1.gz last;


RewriteCond $1 !^(index\.php|public|music|temp|video|images|img|clipart|cat_ico|pages|pictures|cast_stone|artcl|banners|vc|mobile|mobile_cards|phpMA2|myphpadmin3|fla sh_cards|flash_user|captcha|pcards|server.swf|client.swf|help.swf|user_faces|bots.txt|favicon\.ico|update\.php|yandex_57de7ec45e87f775.txt)

rewrite ^/(.*)$ index.php/$1 last;


Thanks


Tim

Posted at Nginx Forum: http://forum.nginx.org/read.php?2,38493,38493#msg-38493




More information about the nginx mailing list