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

Who else has converted from phpBB? How did you deal with .htaccess redirects?

Discussion in 'XenForo Questions and Support' started by Brogan, Jan 28, 2011.

  1. Brogan

    Brogan XenForo Moderator Staff Member

    I'm converting tonight and just wondered how others are handling redirects.

    First there's the issue of redirecting /forum to /community.
    Presumably this will do the job?
    RewriteRule ^forum\/$ "community\/" [R=301,L]

    In addition, there are a few specific threads I would like to redirect but I couldn't seem to get it to work. I tried this:
    RewriteRule ^forum\/viewtopic\.php\?f=51&t=822$ "http\:\/\/www\.mysite\.com\/community\/pages\/home\/" [R=301,L]

    But it didn't work for some reason.

    Has anyone else managed to redirect a specific thread in this way?
  2. Luke F

    Luke F Well-Known Member

    You'd probably be better off with

    RewriteRule ^forum(.*) community$1 [R=301]
    RewriteRule ^forum(.*) community/ [R=301]
    (most likely the latter if you're handling redirections manually)

    RewriteRule doesn't support reading from the query string, you have to use a seperate RewriteCond line (this is why I prefer nginx :p - so much simpler to configure)

    RewriteCond %{QUERY_STRING} ^f=51&t=822$
    RewriteRule ^forum/viewtopic.php community/whatever [R=301,L]
    You can also access regex backreferences from the RewriteCond in the RewriteRule using %1 rather than $1.
    Brogan likes this.
  3. Brogan

    Brogan XenForo Moderator Staff Member

    Many thanks DI, you're a life saver :)
    There's one thread on my site which receives thousands of hits every month so I really didn't want to lose the traffic when converting.

    Does that have to come before the main forum rewrite or doesn't it matter?

Share This Page