server { listen 80; server_name fs.server; charset off; error_page 404 /index.php?error404; autoindex off; location / { root /var/www/fs; index index.php; if ($http_host ~* "^www\.(.*)"){ rewrite ^(.*)$ http://%1/$1 redirect; } rewrite ^/([a-z][a-z])/?$ /index.php?customer_lang_short=$1; rewrite ^/([a-z][a-z])/index\.html$ /index.php?customer_lang_short=$1; rewrite ^/(([a-z][a-z])/)?contacts\.html$ /index.php?module=contacts&customer_lang_short=$2; rewrite ^/(([a-z][a-z])/)?price_list\.html$ /index.php?module=price_list&customer_lang_short=$2; rewrite ^/([a-z][a-z])/psearch\.html$ /index.php?module=products&act=show_sform&customer_lang_short=$1; rewrite ^/([a-z][a-z])/psearch/results-p([0-9]+)\.html$ /index.php?module=products&act=search&page=$2&customer_lang_short=$1; rewrite ^/([a-z][a-z])/cart\.html$ /index.php?module=cart&act=open&customer_lang_short=$1; rewrite ^/([a-z][a-z])/cart/([a-z_]+)\.html$ /index.php?module=cart&act=$2&customer_lang_short=$1; rewrite ^/([a-z][a-z])/order_status.html$ /index.php?module=order_status&customer_lang_short=$1; rewrite ^/([a-z][a-z])/products_compare\.html$ /index.php?module=products_compare&act=list&customer_lang_short=$1; rewrite ^/(([a-z][a-z])/)?sitemap.html$ /index.php?module=sitemap&customer_lang_short=$2; rewrite ^/(([a-z][a-z])/)?newest\.html$ /index.php?module=newest&act=show_items&customer_lang_short=$2; rewrite ^/(([a-z][a-z])/)?rss/newest\.xml$ /index.php?module=newest&act=rss&customer_lang_short=$2; rewrite ^/(([a-z][a-z])/)?bestsellers\.html$ /index.php?module=bestsellers&act=show_items&customer_lang_short=$2; rewrite ^/(([a-z][a-z])/)?news\.html$ /index.php?module=news&act=list&customer_lang_short=$2; rewrite ^/(([a-z][a-z])/)?news/([0-9]+)\.html$ /index.php?module=news&fact_id=$3&customer_lang_short=$2; rewrite ^/(([a-z][a-z])/)?news/archive\.html$ /index.php?module=news&act=archive&customer_lang_short=$2; rewrite ^/(([a-z][a-z])/)?news/subscribe\.html$ /index.php?module=news&act=subscribe&customer_lang_short=$2; rewrite ^/([a-z][a-z])/news/subscribe/confirm/([0-9A-Za-z]+)/ /index.php?module=news&act=confirm_subscribe&key=$2&customer_lang_short=$1; rewrite ^/([a-z][a-z])/news/unsubscribe/([0-9A-Za-z]+)/ /index.php?module=news&act=unsubscribe&key=$2&customer_lang_short=$1; rewrite ^/(([a-z][a-z])/)?rss/news\.xml$ /index.php?module=news&act=rss&customer_lang_short=$2; rewrite ^/(([a-z][a-z])/)?articles\.html$ /index.php?module=articles&act=list&page=1&cat_name=0&customer_lang_short=$2; rewrite ^/(([a-z][a-z])/)?articles-p([0-9]+)-([a-z0-9_-]+)\.html$ /index.php?module=articles&act=list&page=$3&cat_name=$4&customer_lang_short=$2; rewrite ^/(([a-z][a-z])/)?article-([a-z0-9_-]+)\.html$ /index.php?module=articles&art_name=$3&customer_lang_short=$2; rewrite ^/(([a-z][a-z])/)?([a-z0-9_-]+)-p([0-9]+)-articles\.html$ /index.php?module=articles&act=list&page=$4&cat_name=$3&customer_lang_short=$2; rewrite ^/(([a-z][a-z])/)?([a-z0-9_-]+)-article\.html$ /index.php?module=articles&art_name=$3&customer_lang_short=$2; rewrite ^/(([a-z][a-z])/)?manuf-p([0-9]+)-([a-z0-9_-]+)\.html$ /index.php?module=manufacturers&act=show&manuf_name=$4&page=$3&customer_lang_short=$2; rewrite ^/(([a-z][a-z])/)?([a-z0-9_-]+)-p([0-9]+)-manuf\.html$ /index.php?module=manufacturers&act=show&manuf_name=$3&page=$4&customer_lang_short=$2; rewrite ^/(([a-z][a-z])/)?manufs\.html$ /index.php?module=manufacturers&act=list&customer_lang_short=$2; rewrite ^/(([a-z][a-z])-)?p([0-9]+)-([a-z0-9_-]+)/by-price-([,0-9]+)-([,0-9]+)\.html$ /index.php?module=products&page=$3&cat_name=$4&customer_lang_short=$2 break; rewrite ^/(([a-z][a-z])-)?p([0-9]+)-([a-z0-9_-]+)/by-manuf-([0-9]+)\.html$ /index.php?module=products&page=$3&cat_name=$4&customer_lang_short=$2; rewrite ^/(([a-z][a-z])-)?p([0-9]+)-([a-z0-9_-]+)\.html$ /index.php?module=products&page=$3&cat_name=$4&customer_lang_short=$2; if ($query_string ~ "^p=([0-9]+)"){ rewrite ^/(([a-z][a-z])/)?([,a-z0-9_/-]+/)$ /index.php?module=products&page=%1&cat_name=$3&customer_lang_short=$2; } if ($query_string ~ "&p=([0-9]+)"){ rewrite ^/(([a-z][a-z])/)?([,a-z0-9_/-]+/)$ /index.php?module=products&page=%1&cat_name=$3&customer_lang_short=$2; } rewrite ^/(([a-z][a-z])/)?([,a-z0-9_/-]+/)$ /index.php?module=products&cat_name=$3&customer_lang_short=$2; rewrite ^/([a-z0-9_-]+)-p([0-9]+)(-([a-z][a-z]))?/by-price-([,0-9]+)-([,0-9]+)\.html$ /index.php?module=products&page=$2&cat_name=$1&customer_lang_short=$4 break; rewrite ^/([a-z0-9_-]+)-p([0-9]+)(-([a-z][a-z]))?/by-manuf-([0-9]+)\.html$ /index.php?module=products&page=$2&cat_name=$1&customer_lang_short=$4; rewrite ^/([a-z0-9_-]+)-p([0-9]+)(-([a-z][a-z]))?\.html$ /index.php?module=products&page=$2&cat_name=$1&customer_lang_short=$4; rewrite ^/([a-z][a-z])/account\.html$ /index.php?module=account&act=show&customer_lang_short=$1; rewrite ^/([a-z][a-z])/account/register\.html$ /index.php?module=account&act=register&customer_lang_short=$1; rewrite ^/([a-z][a-z])/account/([a-z]+)\.html$ /index.php?module=account&act=$2&customer_lang_short=$1; rewrite ^/([a-z][a-z])/account/forgot/password\.html$ /index.php?module=account&act=pwd_recover&customer_lang_short=$1; rewrite ^/([a-z][a-z])/account/forgot/password/([0-9a-z]+)\.html$ /index.php?module=account&act=pwd_recover&key=$2&customer_lang_short=$1; rewrite ^/([a-z][a-z])/account/activate/([0-9a-z]+)\.html$ /index.php?module=account&act=activate&key=$2&customer_lang_short=$1; rewrite ^/([a-z][a-z])/messages\.html$ /index.php?module=messages&act=show_topics&customer_lang_short=$1; rewrite ^/([a-z][a-z])/messages/([a-z_]+)\.html$ /index.php?module=messages&act=$2&customer_lang_short=$1; rewrite ^/([a-z][a-z])/messages/show_topic/([0-9]+)\.html$ /index.php?module=messages&act=show_topic&id=$2&customer_lang_short=$1; rewrite ^/([a-z][a-z])/messages/show_topic/([0-9]+)/again\.html$ /index.php?module=messages&act=show_topic&id=$2&again=1&customer_lang_short=$1; rewrite ^/([a-z][a-z])/messages/new_topic/again\.html$ /index.php?module=messages&act=new_topic&again=1&customer_lang_short=$1; rewrite ^/(([a-z][a-z])/)?reviews\.html$ /index.php?module=reviews&customer_lang_short=$2; rewrite ^/(([a-z][a-z])/)?gallery([0-9]*)\.html$ /index.php?module=gallery&group_id=$3&customer_lang_short=$2; rewrite ^/(([a-z][a-z])/)?questionary\.html$ /index.php?module=questionary&customer_lang_short=$2; rewrite ^/(([a-z][a-z])/)?tags\.html$ /index.php?module=tags&act=list&customer_lang_short=$2; rewrite ^/(([a-z][a-z])/)?tags-p([0-9]+)-([0-9]+)\.html$ /index.php?module=tags&act=show_items&tag_id=$4&page=$3&customer_lang_short=$2; rewrite ^/([a-z][a-z])/egoods/([0-9]+)/([a-zA-Z0-9]+)$ /index.php?module=getegoodfile&act=download&file_id=$2&key=$3&customer_lang_short=$1; rewrite ^/([a-z][a-z])/get/free/egood/([0-9]+)/([0-9]+).html$ /index.php?module=getegoodfile&act=get_free&cat_id=$2&prod_id=$3&customer_lang_short=$1; rewrite ^/([a-z][a-z])/partner/([0-9]+)\.html$ /index.php?partner_id=$2&customer_lang_short=$1; rewrite ^/(([a-z0-9_/-]+)?[a-z0-9_-]+)\.html$ /index.php?module=product&prod_name=$1; } location /admin { rewrite ^/admin$ /admin/ redirect; rewrite ^/admin/?$ /admin/index.php; } location /index { rewrite ^/index.(html|htm)$ / redirect; } location ~ /install/$ { root /var/www/fs; index index.php; } location /includes/libs/ { root /var/www/fs; index index.php; } location ~ google[a-z0-9]+\.html$ { root /var/www/fs; index index.php; } location ~ yandex_[a-z0-9]+\.html$ { root /var/www/fs; index index.php; } location ~ wmail_[a-z0-9]+\.html$ { root /var/www/fs; index index.php; } location /uploads/banners/ { root /var/www/fs; index index.php; } location ~ \.php$ { fastcgi_pass 127.0.0.1:9000; fastcgi_index index.php; fastcgi_param SCRIPT_FILENAME /var/www/fs$fastcgi_script_name; include fastcgi_params; } }