Best way to redirect multiple urls?

Discussion in 'Site & Server Administration' started by JasMate, Dec 10, 2007.

  1. #1
    I have a site with about 50 urls that need to be changed permanently.
    Example from mysite.com/day_swimming.htm to mysite.com/day-swimming.html
    What is the fastest way to do this?
    Thanks in advance.
     
    JasMate, Dec 10, 2007 IP
  2. Jean-Luc

    Jean-Luc Peon

    Messages:
    601
    Likes Received:
    30
    Best Answers:
    0
    Trophy Points:
    0
    #2
    RedirectPermanent /day_swimming.htm http://www.mysite.com/day-swimming.html
    RedirectPermanent /this_url.htm http://www.mysite.com/a_new_url.html
    RedirectPermanent /that_url.htm http://www.mysite.com/another_new_url.html
    
    Code (markup):
    will do the job.

    If the point is to replace unchanged.htm by unchanged.html, there is an easier solution with:
    RewriteEngine on
    RewriteRule ^(.*)\.htm$ http://www.mysite.com$1.html [L,R=301]
    
    Code (markup):
    Jean-Luc
     
    Jean-Luc, Dec 11, 2007 IP
  3. JasMate

    JasMate Active Member

    Messages:
    2,592
    Likes Received:
    74
    Best Answers:
    0
    Trophy Points:
    90
    #3
    Cheers for that. Yeah I need to change the underscores to hyphens also.
    So I just add those lines to my htaccess. ok now to busy with it :)
     
    JasMate, Dec 11, 2007 IP