Search & Replace + Redirect with Mod_Rewrite?

Discussion in 'Apache' started by VikR, Apr 29, 2008.

  1. #1
    I need to change the variable names in query strings. This is because I need to get two different supplier companies talking to each other. (One supplier uses variable names that the other supplier doesn't recognize).

    So I'm getting supplier A to send the URL to one of my domains, where I can change the variable names in the query string, and then redirect to the web site of supplier B.

    For example, I'd like to change:

    http://www.my_domain_name.com/wsb.dll/s/12345?DDR2=test_2_data&DDR3=
    test_3_data​

    ...to:

    https://supplier_B.com/wsb.dll/s/12345?wsb5=test_2_data&wsb6= test_3_data​

    Here's my current mod rewrite code, which gives me a "Internal Server Error" message:

    Options +FollowSymLinks
    Options +Indexes
    RewriteEngine On
    
    RewriteRule ^(.*)DDR2(.*)$ $1wsb5$2 [NC]
    
    RewriteRule ^(.*)DDR3(.*)$ $1wsb6$2 [NC,L]
    
    Redirect (.*)my_domain_name.com/wsb.dll/(.*) $supplier_B.com/wsb.dll/$2
    Code (markup):
    What is the correct mod_rewrite code to do this?

    Thanks very much in advance to all for any info.
     
    VikR, Apr 29, 2008 IP