Small Rewrite Problem

Discussion in 'Site & Server Administration' started by Weirfire, Jan 19, 2009.

  1. #1
    I'm trying to do a rewrite using the following code;

    RewriteRule ^index.asp?PageAction=VIEWPROD&ProdID=2$ /foot-350mhz-patch-cable-p-26169.html [L]
    Code (markup):
    It's basically an old ecommerce site link and I want to point it the new link so I keep as much of the search engine traffic for the old links as possible.

    I want

    index.asp?PageAction=VIEWPROD&ProdID=2

    to redirect to

    foot-350mhz-patch-cable-p-26169.html

    Any ideas why the redirect isn't working. All the other blurb before the rewrite is correct because I have other redirects which are working correctly.
     
    Weirfire, Jan 19, 2009 IP
  2. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #2
    RewriteRule ^index\.asp?PageAction=VIEWPROD&ProdID=2$ http://www.DOMAIN.com/foot-350mhz-patch-cable-p-26169.html [R=301,L]

    Odds are, it won't work, being a dynamic URL that it's redirecting from. Run over to webmasterworld.com/apache/ where da REAL mod_rewrite master lives!!!

    I had to add some

    RewriteCond %{QUERY_STRING} ^

    code to redirect a vBulletin thread URL to another thread URL.
     
    Nintendo, Jan 19, 2009 IP
  3. Weirfire

    Weirfire Language Translation Company

    Messages:
    6,979
    Likes Received:
    365
    Best Answers:
    0
    Trophy Points:
    280
    #3
    Thanks Nintendo. I managed to write the solution myself using the rewrite condition just have you have stated on your reply post.
     
    Weirfire, Jan 21, 2009 IP