Help witha redirect

Discussion in 'Apache' started by ollyno1uk, Dec 12, 2007.

  1. #1
    I'm not sure if this is possbile but I have a store that has changed some of its urls

    here is the old type

    http://www.mysite.com/productscategories

    Here is the new

    http://www.mysite.com/products_categories

    No I prefer the new but I have 10000s of links pointing to the old

    I have about 80 categories like this.

    Can I do some kind of redirect from the old url to the new?

    I'm more than happy to manually type each category out if necessary but I have no idea how to do it and would this amount of redirects cause lag on the server?

    Advice would be apprecaited
     
    ollyno1uk, Dec 12, 2007 IP
  2. buldozerceto

    buldozerceto Active Member

    Messages:
    1,137
    Likes Received:
    43
    Best Answers:
    0
    Trophy Points:
    88
    #2
    This is 301 redirect - put in the root of www.mysite.com in file named .htaccess
    RewriteEngine On
    RewriteBase /
    RewriteRule ^productscategories$ /products_categories [R=permanent,L]

    same with php - put this at the very top in the file that handles productscategories
    <?php
    header( "HTTP/1.1 301 Moved Permanently" );
    header( "Location: products_categories" );
    die();
    ?>
     
    buldozerceto, Dec 12, 2007 IP
  3. ollyno1uk

    ollyno1uk Active Member

    Messages:
    946
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    70
    #3
    That is very kind of you and I will begin to implement these changes right away

    Thanks a lot
     
    ollyno1uk, Dec 13, 2007 IP
  4. ollyno1uk

    ollyno1uk Active Member

    Messages:
    946
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    70
    #4
    Ok didn't quite work as hoped - here is what I put


    RewriteRule ^computersystems-c-22.html$ /computer-systems-c-22.html [R=permanent,L]

    I can still visit the link computersystems which I was expecting it to go to computer-systems

    Perhaps its has soemthing to do with the additiona -c-22.html which I did not mention previously?

    Thanks a lot
     
    ollyno1uk, Dec 13, 2007 IP
  5. buldozerceto

    buldozerceto Active Member

    Messages:
    1,137
    Likes Received:
    43
    Best Answers:
    0
    Trophy Points:
    88
    #5
    Where is computersystems-c-22.html? In the root dir of your site or in some subfolder?
    Is computersystems-c-22.html static html page or already dynamically rewritten?
     
    buldozerceto, Dec 13, 2007 IP
  6. ollyno1uk

    ollyno1uk Active Member

    Messages:
    946
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    70
    #6
    It was already rewritten I believe and it resides in the root of the store.

    Its an oscommerce store and computersystems and computer-systems go to the same place as I am led to believe the 22 is the important part rather than the text so anytext-c-22.html will go to the same place.

    Hope this makes sense,

    Thanks

    I
     
    ollyno1uk, Dec 13, 2007 IP
  7. ollyno1uk

    ollyno1uk Active Member

    Messages:
    946
    Likes Received:
    27
    Best Answers:
    0
    Trophy Points:
    70
    #7
    Can anyone help?

    Thanks
     
    ollyno1uk, Dec 15, 2007 IP
  8. buldozerceto

    buldozerceto Active Member

    Messages:
    1,137
    Likes Received:
    43
    Best Answers:
    0
    Trophy Points:
    88
    #8
    Than you need a change in htaccess
    Post you htaccess file here
     
    buldozerceto, Dec 18, 2007 IP