URL Rewrite Help for moving Forum

Discuss practical ways rearrange URLs using mod_rewrite.

URL Rewrite Help for moving Forum

Postby AtariAge » Thu Apr 21, 2005 7:49 pm

Greetings,

I recently switched forum software from phpBB to IPB, and I imported 830,000 messages in the process. There are many (thousands, probably) links to posts on the old forum (and elsewhere on the web), and I'd like to redirect them to the new forum. Fortunately, the forum and topic IDs are the same, to this should be relatively easy to do. Unfortunately, I am not succeeding in writing a mod_rewrite rule to accomplish this.

I am putting these rules in an .htaccess file located in the webroot. The forums are located at /forums/. Here's the first examples of an URL I need to convert from phpBB to IPB:

From:
http://www.atariage.com/forums/viewtopic.php?t=63921

To:
http://www.atariage.com/forums/index.ph ... opic=63921

Here's the second example:

From:
http://www.atariage.com/forums/viewforum.php?f=16

To:
http://www.atariage.com/forums/index.php?showforum=16

Here's an example of a rewrite rule I've tried for the first example:

RewriteEngine On
RewriteRule ^forums/viewtopic\.php\?t=(.+)$ forums/index.php?showtopic=$1 [R,L]

Oddly, if I simplify it to:

RewriteRule ^forums/viewtopic\.php$ forums/index.php [R,L]

it will actually redirect viewtopic.php to index.php, so I know that the mod_rewrite engine is active. But as soon as I try to make it more complex, I get a 404 error (the viewtopic.php file no longer exist in the forums directory).

I greatly appreciate any help in getting this to work.

Thanks!!

..Al
AtariAge
 

Postby AtariAge » Sat Apr 23, 2005 8:42 am

Did I perhaps post this in the wrong forum? :) I haven't yet been able to get this to work and I'd greatly appreciate any assistance in figuring this out. If any additional information is needed, please let me know and I'll provide it promptly.

Thanks again!

..Al
AtariAge
 

Postby Gandalf » Sat Apr 23, 2005 9:21 am

my guess would be switch your code like this:

Code: Select all
RewriteEngine On
RewriteRule ^forums/index.php?showtopic=(.+)$ forums/viewtopic.php?t=$1 [R,L]


try it and let me know.
Gandalf
 
Posts: 20
Joined: Thu Apr 14, 2005 6:01 pm

Postby AtariAge » Sat Apr 23, 2005 12:32 pm

Gandalf wrote:my guess would be switch your code like this:

Code: Select all
RewriteEngine On
RewriteRule ^forums/index.php?showtopic=(.+)$ forums/viewtopic.php?t=$1 [R,L]


try it and let me know.

Unfortunately that doesn't work either, I am still receiving a 404 error. :(

..Al
AtariAge
 

Postby Gandalf » Sun Apr 24, 2005 4:21 am

try this one then

Code: Select all
RewriteEngine On
RewriteRule ^index.php?showtopic=([0-9]*)$ viewtopic.php?t=$1 [L]


add this .htaccess file to root of your phpBB forum.
Gandalf
 
Posts: 20
Joined: Thu Apr 14, 2005 6:01 pm

Postby AtariAge » Sun Apr 24, 2005 12:09 pm

Gandalf wrote:try this one then

Code: Select all
RewriteEngine On
RewriteRule ^index.php?showtopic=([0-9]*)$ viewtopic.php?t=$1 [L]


add this .htaccess file to root of your phpBB forum.

Unfortunately this does not work either. Just to be clear, I went from phpBB over to IPB, so I need to change the "viewtopic.php" URL into the "index.php?showtopic" URL.

Thanks again!

..Al
AtariAge
 

Postby AtariAge » Sun Apr 24, 2005 12:22 pm

Just to add some additional information, I looked in the Apache error log and I see this:

[Sun Apr 24 15:19:31 2005] [error] [client 66.93.XXX.XXX] File does not exist: /home/atariage/public_html/forums/viewtopic.php

..Al
AtariAge
 

Postby AtariAge » Wed Apr 27, 2005 8:51 am

Still unable to get this to work. Anyone? :D

..Al
AtariAge
 

Postby Caterham » Thu Apr 28, 2005 4:58 am

put this into your root (/home/atariage/public_html/.htaccess)

Code: Select all
RewriteEngine On
RewriteCond %{QUERY_STRING} (t|f)=([0-9]+)
RewriteRule ^forums/view(topic|forum)\.php$ /forums/index.php?show$1=%1 [R=301,L]
Caterham
 
Posts: 690
Joined: Fri Dec 10, 2004 1:30 pm

Postby AtariAge » Thu Apr 28, 2005 2:26 pm

Caterham wrote:put this into your root (/home/atariage/public_html/.htaccess)

Code: Select all
RewriteEngine On
RewriteCond %{QUERY_STRING} (t|f)=([0-9]+)
RewriteRule ^forums/view(topic|forum)\.php$ /forums/index.php?show$1=%1 [R=301,L]


Nice, progress, thanks! This is closer, but doesn't quite work. When I enter the following URL:

Code: Select all
http://www.atariage.com/forums/viewtopic.php?t=65846


This is what I end up seeing:

Code: Select all
http://www.atariage.com/forums/index.php?showtopic=t


Close, though! :D

Likewise, if I try this URL:

Code: Select all
http://www.atariage.com/forums/viewforum.php?f=16


I am just being redirected to the new forum's index (I assume the forum is detecting an error in the viewforum variable).

Thanks for your help!

..Al
AtariAge
 

Next

Return to Friendly URLs with Mod_Rewrite

Who is online

Users browsing this forum: Google [Bot] and 3 guests

cron