1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Quick .htaccess Question

Discussion in 'Apache' started by T0PS3O, Mar 18, 2005.

  1. #1
    Obviously not an expert on this...

    redirect 301 /index.php?cPath=21_22_21 http://www.my-domain.co.uk/product-c-21.html
    Code (markup):
    Why would this not work?

    Can you not 301 variable specific (cPath=21_22_21) URLs?
     
    T0PS3O, Mar 18, 2005 IP
  2. piniyini

    piniyini Well-Known Member

    Messages:
    514
    Likes Received:
    26
    Best Answers:
    0
    Trophy Points:
    170
    #2
    RewriteRule index.php?cPath=21_22_21$ /product-c-21.html [R=301,L]
    Code (markup):
    htaccess 301 (my site :p )
     
    piniyini, Mar 18, 2005 IP
  3. J.D.

    J.D. Peon

    Messages:
    1,198
    Likes Received:
    65
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Redirect works with paths. That is, if Apache matches the beginning of the actual path to the one specified in Redirect, it will replace the matched part in the actual path and will leave the tail intact.

    As for RewriteRule, it will not match the query string. You need to use RewriteCond for this:

    RewriteCond %{QUERY_STRING} ^cPath=21_22_21$
    RewriteRule ^index.php$ http://www.my-domain.co.uk/product-c-21.html [R=301,L]

    J.D.
     
    J.D., Mar 18, 2005 IP