htaccess redirect for oscommerce store

Discussion in 'PHP' started by assembler, Nov 13, 2006.

  1. #1
    I am migrating from a oscommerce to a new shopping cart. I need help with a wildcard redirect...

    I need all three of these to go to the same place:
    /catalog/product_info.php/cPath/1/products_id/1234
    /catalog/product_info.php/products_id/1234
    /catalog/product_info.php/manufacturers_id/2/products_id/1234

    all should be directed to:
    /product/1234

    Can I just do:
    RewriteRule ^products_id/(.*) /product/$1

    I've been messing with this, but it doesn't seem to be working correctly.
     
    assembler, Nov 13, 2006 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    
    
    RewriteRule ^catalog\/product_info\.php\/cPath\/1\/products_id/([0-9]+)$ /product/$1
    RewriteRule ^catalog\/product_info\.php\/products_id\/([0-9]+)$ /product/$1
    RewriteRule ^catalog\/product_info\.php\/manufacturers_id\/2\/products_id\/([0-9]+)$ /product/$1
    
    Code (markup):
    Untested, but give it a try.
     
    nico_swd, Nov 13, 2006 IP
  3. assembler

    assembler Guest

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    So you don't believe it can be done with one redirect statement?
     
    assembler, Nov 13, 2006 IP
  4. mad4

    mad4 Peon

    Messages:
    6,986
    Likes Received:
    493
    Best Answers:
    0
    Trophy Points:
    0
    #4
    It can't be done with one statement, no.
     
    mad4, Nov 13, 2006 IP
  5. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #5
    EDIT: ^^ Maybe with the | operator.

    Uh, yeah. Try this. (Untested)
    
    RedirectMatch 301 ^catalog\/product_info\.php/(cPath\/1\/(products_id)?|manufacturers_id\/2\/)\/([0-9]+)$ /product/$1
    
    Code (markup):
     
    nico_swd, Nov 13, 2006 IP
  6. Chemo

    Chemo Peon

    Messages:
    146
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Try this:
    
    RewriteEngine On 
    RewriteBase /catalog/
    
    RewriteRule ^product_info\.php(/.*/)?\/product_id/([0-9]+) /product/$2&%{QUERY_STRING}
    
    Code (markup):
    Paste this in the htaccess file located in the /catalog/ directory.

    Bobby
     
    Chemo, Nov 13, 2006 IP