Forum Moderators: phranque
RewriteEngine On
RewriteBase /
ErrorDocument 400 /400.shtml
ErrorDocument 401 /400.shtml
ErrorDocument 402 /400.shtml
ErrorDocument 403 /400.shtml
ErrorDocument 404 /400.shtml
ErrorDocument 405 /400.shtml
ErrorDocument 500 /400.shtml
#RewriteCond %{REMOTE_ADDR} 68.106.156.35 [OR]
#RewriteCond %{REMOTE_ADDR} 68.106.156.43
RewriteCond %{HTTPS} !on
RewriteRule catalog/images/(.*) http://www.example.com:8080/catalog/images/$1 [L,R]
RewriteCond %{HTTP_HOST} ^example\.com [NC]
RewriteRule (.*) http://www.example.com/$1 [R=301,QSA,L]
RewriteRule ^index.html /catalog/index.php [L,QSA]
RewriteRule ^index.php /catalog/index.php [L,QSA]
RewriteRule ^$ /catalog/index.php [L,QSA]
RewriteRule sitemap.html catalog/sitemap.php [L]
RewriteRule ^admin/(.*)$ catalog/admin/$1 [QSA,L]
RewriteRule ^admin$ catalog/admin/ [L]
RewriteRule ^products_new.php http://www.example.com/catalog/products_new.php [R=301,QSA,L]
RewriteRule ^account.php http://www.example.com/catalog/account.php [R=301,QSA,L]
RewriteRule ^account_edit.php http://www.example.com/catalog/account_edit.php [R=301,QSA,L]
RewriteRule ^account_history.php http://www.example.com/catalog/account_history.php [R=301,QSA,L]
RewriteRule ^account_history_info.php http://www.example.com/catalog/account_history_info.php [R=301,QSA,L]
RewriteRule ^account_newsletters.php http://www.example.com/catalog/account_newsletters.php [R=301,QSA,L]
RewriteRule ^account_notifications.php http://www.example.com/catalog/account_notifications.php [R=301,QSA,L]
RewriteRule ^account_password.php http://www.example.com/catalog/account_password.php [R=301,QSA,L]
RewriteRule ^add_checkout_success.php http://www.example.com/catalog/add_checkout_success.php [R=301,QSA,L]
RewriteRule ^address_book.php http://www.quux-foo/catalog/address_book.php [r=301,QSA,L]
RewriteRule ^address_book_process.php http://www.example.com/catalog/address_book_process.php [R=301,QSA,L]
RewriteRule ^advanced_search.php http://www.example.com/catalog/advanced_search.php [R=301,QSA,L]
RewriteRule ^advanced_search_result.php http://www.example.com/catalog/advanced_search_result.php [R=301,QSA,L]
RewriteRule ^allprods.php http://www.example.com/catalog/allprods.php [R=301,QSA,L]
RewriteRule ^best_sellers.php http://www.example.com/catalog/best_sellers.php [R=301,QSA,L]
RewriteRule ^checkout_confirmation.php http://www.example.com/catalog/checkout_confirmation.php [R=301,QSA,L]
RewriteRule ^checkout_payment.php http://www.example.com/catalog/checkout_payment.php [R=301,QSA,L]
RewriteRule ^checkout_payment_address.php http://www.example.com/catalog/checkout_payment_address.php [R=301,QSA,L]
RewriteRule ^checkout_process.php http://www.example.com/catalog/checkout_process.php [R=301,QSA,L]
RewriteRule ^checkout_shipping.php http://www.example.com/catalog/checkout_shipping.php [R=301,QSA,L]
RewriteRule ^checkout_shipping_address.php http://www.example.com/catalog/checkout_shipping_address.php [R=301,QSA,L]
RewriteRule ^checkout_success.php http://www.example.com/catalog/checkout_success.php [R=301,QSA,L]
RewriteRule ^conditions.php http://www.example.com/catalog/conditions.php [R=301,QSA,L]
RewriteRule ^contact_us.php http://www.example.com/catalog/contact_us.php [R=301,QSA,L]
RewriteRule ^cookie_usage.php http://www.example.com/catalog/cookie_usage.php [R=301,QSA,L]
RewriteRule ^create_account.php http://www.example.com/catalog/create_account.php [R=301,QSA,L]
RewriteRule ^create_account_success.php http://www.example.com/catalog/create_account_success.php [R=301,QSA,L]
RewriteRule ^customer_testimonials.php http://www.example.com/catalog/customer_testimonials.php [R=301,QSA,L]
RewriteRule ^download.php http://www.example.com/catalog/download.php [R=301,QSA,L]
RewriteRule ^gv_faq.php http://www.example.com/catalog/gv_faq.php [R=301,QSA,L]
RewriteRule ^gv_redeem.php http://www.example.com/catalog/gv_redeem.php [R=301,QSA,L]
RewriteRule ^gv_send.php http://www.example.com/catalog/gv_send.php [R=301,QSA,L]
RewriteRule ^info_shopping_cart.php http://www.example.com/catalog/info_shopping_cart.php [R=301,QSA,L]
RewriteRule ^ipn.php http://www.example.com/catalog/ipn.php [R=301,QSA,L]
RewriteRule ^links.php http://www.example.com/catalog/links.php [R=301,QSA,L]
RewriteRule ^links_submit.php http://www.example.com/catalog/links_submit.php [R=301,QSA,L]
RewriteRule ^links_submit_success.php http://www.example.com/catalog/links_submit_success.php [R=301,QSA,L]
RewriteRule ^login.php http://www.example.com/catalog/login.php [R=301,QSA,L]
RewriteRule ^logoff.php http://www.example.com/catalog/logoff.php [R=301,QSA,L]
RewriteRule ^Order_Info.php http://www.example.com/catalog/Order_Info.php [R=301,QSA,L]
RewriteRule ^Order_Info_Process.php http://www.example.com/catalog/Order_Info_Process.php [R=301,QSA,L]
RewriteRule ^pages.php http://www.example.com/catalog/pages.php [R=301,QSA,L]
RewriteRule ^password_forgotten.php http://www.example.com/catalog/password_forgotten.php [R=301,QSA,L]
RewriteRule ^popup_coupon_help.php http://www.example.com/catalog/popup_coupon_help.php [R=301,QSA,L]
RewriteRule ^popup_image.php http://www.example.com/catalog/popup_image.php [R=301,QSA,L]
RewriteRule ^popup_links_help.php http://www.example.com/catalog/popup_links_help.php [R=301,QSA,L]
RewriteRule ^popup_paypal.php http://www.example.com/catalog/popup_paypal.php [R=301,QSA,L]
RewriteRule ^popup_print_invoice.php http://www.example.com/catalog/popup_print_invoice.php [R=301,QSA,L]
RewriteRule ^popup_search_help.php http://www.example.com/catalog/popup_search_help.php [R=301,QSA,L]
RewriteRule ^privacy.php http://www.example.com/catalog/privacy.php [R=301,QSA,L]
RewriteRule ^product_info.php http://www.example.com/catalog/product_info.php [R=301,QSA,L]
RewriteRule ^product_reviews.php http://www.example.com/catalog/product_reviews.php [R=301,QSA,L]
RewriteRule ^product_reviews_info.php http://www.example.com/catalog/product_reviews_info.php [R=301,QSA,L]
RewriteRule ^product_reviews_write.php http://www.example.com/catalog/product_reviews_write.php [R=301,QSA,L]
RewriteRule ^product_new.php http://www.example.com/catalog/product_new.php [R=301,QSA,L]
RewriteRule ^redirect.php http://www.example.com/catalog/redirect.php [R=301,QSA,L]
RewriteRule ^review_notice.php http://www.example.com/catalog/review_notice.php [R=301,QSA,L]
RewriteRule ^reviews.php http://www.example.com/catalog/reviews.php [R=301,QSA,L]
RewriteRule ^shipping.php http://www.example.com/catalog/shipping.php [R=301,QSA,L]
RewriteRule ^shopping_cart.php http://www.example.com/catalog/shopping_cart.php [R=301,QSA,L]
RewriteRule ^specials.php http://www.example.com/catalog/specials.php [R=301,QSA,L]
RewriteRule ^ssl_check.php http://www.example.com/catalog/ssl_check.php [R=301,QSA,L]
RewriteRule ^tell_a_friend.php http://www.example.com/catalog/tell_a_friend.php [R=301,QSA,L]
RewriteRule ^wishlist.php http://www.example.com/catalog/wishlist.php [R=301,QSA,L]
RewriteRule ^wishlist_help.php http://www.example.com/catalog/wishlist_help.php [R=301,QSA,L]
RewriteRule ^wishlist_public.php http://www.example.com/catalog/wishlist_public.php [R=301,QSA,L]
RewriteRule wholesale_(.*)_(.*)\.html$ /catalog/advanced_search_result.php?page=$2&keywords=$1
RewriteCond %{IS_SUBREQ} !=true [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) catalog/dispatcher.php [QSA,L,E=REDIRECT_URL:$1]
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_URI} !-d
#RewriteCond %{REQUEST_URI} !^/catalog/.*
#RewriteCond %{REQUEST_URI} !^catalog/.*
##RewriteRule ^(.+)/(.*)$ ${rhinourls:$0} [QSA,NS]
#RewriteRule (.*) dispatcher.php [QSA,L,E=REDIRECT_URL:$1]
#RewriteCond %{REQUEST_URI} ^/$
#RewriteRule ^$ /catalog/index.php [NS,L]
[edited by: jdMorgan at 8:28 pm (utc) on Aug. 20, 2008]
[edit reason] example.com [/edit]
Redirects should be first. Rewrites should be last.
Your "catch all" redirect should be last in the redirects block, but you have it first. That will lead to a redirection chain for some requests.
The catch-all redirect should be last so that redirects happen in one step, not a chain.
RewriteCond %{IS_SUBREQ} !=true [NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule (.*) catalog/dispatcher.php [QSA,L,E=REDIRECT_URL:$1]
Jim
[edit] Fixed bbCode markup [/edit]
[edited by: jdMorgan at 2:58 am (utc) on Aug. 21, 2008]
Thanks for all your input guys - you know a lot about this stuff
Jim