Redirect to different url with same ID

Discussion in 'Apache' started by willstumpf, May 7, 2007.

  1. #1
    I switched from phpb to mybb and the forum and topic urls are different (its showthread.php?tid= instead of viewtopic.php?t=)

    So what I'm asking is.. is it possible to have it redirect anything that comes in as viewtopic.php?t=number to showthread.php?tid=number, if so how?

    Thank you
     
    willstumpf, May 7, 2007 IP
  2. rodney88

    rodney88 Guest

    Messages:
    480
    Likes Received:
    37
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Assuming you have mod_rewrite enabled, put this in a .htaccess file in your forum directory. Obviously edit the URL to match the URL to your new topic pages.
    Options +FollowSymLinks
    RewriteEngine On
    RewriteCond %{QUERY_STRING} t=([0-9]+)
    RewriteRule ^viewtopic\.php$ http://www.yourdomain.com/showthread.php?tid=%1 [R=301,L]
    Code (markup):
     
    rodney88, May 7, 2007 IP
  3. willstumpf

    willstumpf Peon

    Messages:
    21
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thank you Rodney!! :D
     
    willstumpf, May 7, 2007 IP