301 many pages with simular structure

Discussion in 'Apache' started by tfbpa, Nov 15, 2006.

  1. #1
    Am trying to permanently redirect alot of pages and was wondering if there is a simple fix with .htaccess

    Old page: http://www.domain.com/hd11256816.htm
    New page: http://subdomain.domain.com/hotel/10014030-11256816O.html


    Old page: http://www.domain.com/hd21256816.htm
    New page: http://subdomain.domain.com/hotel/10014030-21256816O.html


    Old page: http://www.domain.com/hd31256816.htm
    New page: http://subdomain.domain.com/hotel/10014030-31256816O.html

    So the only thing that changes with every page is the "11256816" part and should translate into the last bit of the new page as well.

    Hope I'm making sense and that it can be done!
     
    tfbpa, Nov 15, 2006 IP
  2. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #2
    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteRule ^hd(.*)\.htm$ http://sub-domain.domain.com/hotel/10014030-$1O.html [R=301,L]
     
    Nintendo, Nov 16, 2006 IP
  3. tfbpa

    tfbpa The....Alive

    Messages:
    896
    Likes Received:
    35
    Best Answers:
    0
    Trophy Points:
    120
    #3
    Damn, your good!

    Worked like charm and saved me many, many hours. Cheers mate!
     
    tfbpa, Nov 16, 2006 IP