Welcome! Log In Create A New Profile

Advanced

Go Figure -> Apache Rewrites to Nginx

Posted by theduke56789 
Go Figure -> Apache Rewrites to Nginx
October 19, 2010 07:54PM
I've spent hours trying to figure this out and will pay for someone to do it if that's what it's going to take.....

Your help would be immensely appreciated.

[code]
<IfModule mod_rewrite.c>

RewriteEngine On
RewriteBase /

<FilesMatch "\.(ico|pdf|flv|jpg|jpeg|png|gif|js|css|swf)$">
Header set Expires "Thu, 15 Apr 2010 20:00:00 GMT"
</FilesMatch>


ErrorDocument 404 /index.php?page_type=static&page_name=not_found

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{THE_REQUEST} ^GET\ .*/index\.(php|html?)\ HTTP
RewriteRule ^(.*)index\.(php|html?)$ $1 [R=301,L]


RewriteCond %{HTTP_HOST} ^mydomain\.com
RewriteRule ^(.*)$ http://www.mydomain.com/$1 [R=301,L]


###########CATALOG PAGE DISPATCH##############
RewriteRule ^.*/hash-(a[0-9]+)?(b[0-9]+)?(c[0-9]+)?(d[0-9]+)?(p[0-9]+)?(r[0-9]+)?(f[0-9]+)?\.html$ index.php?page_type=dinamic&page_name=catalog&type_id=$1&brand_id=$2&gender_id=$3&onsale=$4&price1=$5&price2=$6&page_id=$7 [L]

###########SEARCH QUERY#######################
RewriteRule ^hash-(f[0-9]+)(search-(.*)-query)?\.html$ index.php?page_type=dinamic&page_name=catalog&page_id=$1&search_query=$3 [L]

###########DONT REMEMBER WHAT THE HELL IS THIS FOR ###########
RewriteRule ^hash-(p[0-9]+)?(r[0-9]+)?(f[0-9]+)?\.html$ index.php?page_type=dinamic&page_name=catalog&price1=$1&price2=$2&page_id=$3 [L]

###SOME SEARCH STUFF####
RewriteRule ^search/?$ index.php?page=search

#ITEM INFO WITH COLOR SELECTED###
RewriteRule ^.*-stockid-([0-9]+)-colorid-([0-9]+)\.html$ index.php?page_type=dinamic&page_name=item_info&show_id=$1&colorid=$2 [L]

##ITEM INFO COLOR NOT SELECTED###
RewriteRule ^.*-stockid-([0-9]+)\.html$ index.php?page_type=dinamic&page_name=item_info&show_id=$1 [L]

#STATIC REWRITES RULES#####

#NEW PAGES
RewriteRule ^register/(.*)?$ index.php?page_type=dinamic&page_name=register_fast&checkout=$1 [L]
RewriteRule ^cart/?$ index.php?page_type=dinamic&page_name=view_cart [L]
RewriteRule ^checkout/?$ index.php?page_type=dinamic&page_name=checkout [L]
#END

RewriteRule ^featured/?$ featured.php [L]
RewriteRule ^catalog/eyeglasses/.*/brandid([0-9]+)/?$ index.php?page_type=dinamic&page_name=catalog&brand_id=$1&type_id=1 [L]
RewriteRule ^catalog/sunglasses/.*/brandid([0-9]+)/?$ index.php?page_type=dinamic&page_name=catalog&brand_id=$1&type_id=2 [L]
RewriteRule ^catalog/eyeglasses/?$ index.php?page_type=dinamic&page_name=catalog&type_id=1 [R=301,L]
RewriteRule ^catalog/sunglasses/?$ index.php?page_type=dinamic&page_name=catalog&type_id=2 [R=301,L]
RewriteRule ^catalog/for-men/?$ index.php?page_type=dinamic&page_name=catalog&gender_id=2 [R=301,L]
RewriteRule ^catalog/for-women/?$ index.php?page_type=dinamic&page_name=catalog&gender_id=1 [R=301,L]
RewriteRule ^catalog/for-kids/?$ index.php?page_type=dinamic&page_name=catalog&gender_id=3 [R=301,L]
RewriteRule ^catalog/for-all/?$ index.php?page_type=dinamic&page_name=catalog&gender_id=4 [R=301,L]
RewriteRule ^catalog/brands/?$ index.php?browse=brands [L]
RewriteRule ^catalog/sale/?$ index.php?page_type=dinamic&page_name=catalog&onsale=1 [R=301,L]
RewriteRule ^my-orders/?$ index.php?page_type=dinamic&page_name=my_orders [L]
RewriteRule ^forgot-password/?$ index.php?page_type=dinamic&page_name=forgot [L]
RewriteRule ^contact-us/?$ index.php?page_type=dinamic&page_name=contact [L]
RewriteRule ^about/?$ index.php?page_type=static&page_name=about [L]
RewriteRule ^faq/?$ index.php?page_type=static&page_name=faq [L]
RewriteRule ^testimonials/?$ index.php?page_type=static&page_name=testimonials [L]
RewriteRule ^shipping/?$ index.php?page_type=static&page_name=shipping_info [L]
RewriteRule ^privacy_policy/?$ index.php?page_type=static&page_name=privacy [L]
RewriteRule ^terms_of_use/?$ index.php?page_type=static&page_name=terms [L]
RewriteRule ^return_policy/?$ index.php?page_type=static&page_name=return_policy [L]
RewriteRule ^brands/?$ index.php?page_type=dinamic&page_name=brands [L]
RewriteRule ^invoice/([0-9]+)?/?$ index.php?page_type=dinamic&page_name=invoice&order_id=$1 [L]
RewriteRule ^packing-slip/([0-9]+)?/?$ index.php?page_type=dinamic&page_name=slip&order_id=$1 [L]
RewriteRule ^.*/stockid/([0-9]+)/.*$ index.php?browse=catalog&show_id=$1 [R=301,L]
RewriteRule ^catalog/pageid([0-9]+)/?$ index.php?page_type=dinamic&page_name=catalog&page_id=$1 [R=301,L]
RewriteRule ^my-account/?$ index.php?page_type=dinamic&page_name=my_account [L]
RewriteRule ^change-billing/?$ index.php?page_type=dinamic&page_name=my_acc_bill [L]
RewriteRule ^change-shipping/?$ index.php?page_type=dinamic&page_name=my_acc_ship [L]
RewriteRule ^change-password/?$ index.php?page_type=dinamic&page_name=my_acc_pw [L]
RewriteRule ^paypal-checkout/?$ index.php?page_type=dinamic&page_name=paypal_pay [L]
RewriteRule ^catalog/.*/brandid([0-9]+)/?$ index.php?page_type=dinamic&page_name=catalog&brand_id=$1 [R=301,L]
RewriteRule ^catalog/?$ index.php?page_type=dinamic&page_name=catalog [L]


</IfModule>


<Files 403.shtml>
order allow,deny
allow from all
</Files>


[/code]



Edited 1 time(s). Last edit at 10/19/2010 07:55PM by theduke56789.
Re: Go Figure -> Apache Rewrites to Nginx
November 12, 2010 02:19PM
Hahah, that doesn't look all [i]that[/i] bad, just extremely time consuming. Are you still having trouble with this? A lot of it is just reiterating the beginning and end syntax in your nginx configuration.
Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 170
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 500 on July 15, 2024
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready