1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Can you do this with .htacess? Strange request

Discussion in 'Black Hat SEO' started by mwoody, Jun 29, 2012.

  1. mwoody

    mwoody Newbie

    Joined:
    Dec 23, 2007
    Messages:
    31
    Likes Received:
    8
    Hi,

    I'm trying to get .htaccess to redirect URLs in the following way

    I would like it to match and redirect the following-

    /Product/
    /Product/page/2/
    /Product/page/3/


    (number of pages will increase so the number at the end should be a wildcard)

    to these urls-

    /product/
    /product/page/2/
    /product/page/3/

    But NOT match and do not redirect any other urls that start with /Product/ such as-

    /Product/Digital-Camera/
    /Product/Guide/Digital-Camera/
    /Product/feed/


    Any idea how to do that? I've been repeatedly slamming my head on my palm for a couple of hours now

    Thanks
     
    Last edited: Jun 29, 2012
  2. mwoody

    mwoody Newbie

    Joined:
    Dec 23, 2007
    Messages:
    31
    Likes Received:
    8
    FYI the simple approach of-

    Code:
    Redirect 301 /Product/ /product/
    has the desired effect, EXCEPT it matches and redirects /Product/Digital-Camera which I don't want it to do
     
  3. mwoody

    mwoody Newbie

    Joined:
    Dec 23, 2007
    Messages:
    31
    Likes Received:
    8
    Ok with

    Code:
    <IfModule mod_rewrite.c>
    RewriteRule ^Product$ /product/ [R=301,L]
    RewriteRule ^Product/$ /product/ [R=301,L]
    </IfModule>
    
    Is succesfully redirecting /product/ but not /Product/Digital-Camera/

    However I still cannot workout how to redirect-

    /Product/page/2/
    /Product/page/3/

    and so forth to

    /product/page/2/
    /product/page/3/

    I imagine its very similar to the rewrite rule above but not sure how to get it to recognise the number and then tag that onto the end of the destination url

    Any ideas?