phpBB Forum Rewrites

Hello I have been reading and trying everything I could find to help me with probably a simple rewrite.

My site is ran through phpnuke (switching to WP soon I hope) and we were using phpBB2 forums as a module. I have recently converted the forums over to VB and what I would like to do is have all the links from the old forum (a lot of people have links directing to worklogs) point to the new one. Here are some examples of what some of the old links look like.



http://www.mysite.com/modules.php?name=Forums&file=viewtopic&p=37356

http://www.mysite.com/modules.php?name=Forums&file=viewforum&f=43



The new forums are now located at

http://www.mysite.com/forums/index.php

It seems that most of the rewrites I tried either did not work or effected all the other modules links too.

At this point in time I would even be happy with any of the old links going right to the forums listing (forums/index.php) and letting people find what they clicked on from there.

Thanks for the help.

Af,

If all your redirections are sending modules.php to forum/index.php, what’s the problem? That’s Trivially simple:

Redirect modules.php /forum/index.php

Capturing your key/value pairs and doing something intelligent with them will depend upon how they match with your phpnuke/WP databases. I wouldn’t bet that they’d be compatible so, unless you get into creating a RewriteMap (whether using RewriteMap or a handler file to do the redirection from a map for you), you’re smart to settle for the simple redirection.

You might benefit from reading the mod_rewrite tutorial linked in my signature as it contains explanations and sample code. It’s helped may members and should help you, too.

Regards,

DK

Am I even close with this one to link it to the index page?

RewriteRule ^modules.php\\?name=Forums&file=viewtopic&p=37356$ http://www.modders-inc.com/forums/index.php [R=301]

Not to sound harsh, but no, you’re not. Thing is, you can’t match the query string within a RewriteRule, you need an accompanying RewriteCond for that. Also, I wouldn’t match all URLs separately, but simply all URL’s that have name=Forums, regardless of what else is in the Query String.


RewriteCond %{QUERY_STRING} name=Forums
RewriteRule ^modules.php$ http://www.modders-inc.com/forums/index.php [L,R=301]

Many Thank You’s go to my good sir!

So far it is working well to redirect any old forum link to the starting point of the new forums.

I’m not sure how SEO it might be, but this will be much better than going to a dead page in my eyes.

If it would not be to much trouble could someone take a quick look at the rest of my .htaccess

I have tested the ones I did and they all seem to work but there might be a better way to do it or a better order :slight_smile:

php_flag register_long_arrays On
# -------------------------------------------
# Start of NukeSentinel(tm) admin.php Auth
# -------------------------------------------
<Files .staccess>
deny from all
</Files>

<Files admin.php>
<Limit GET POST PUT>
require valid-user
</Limit>
AuthName "Restricted by NukeSentinel(tm)"
AuthType Basic
AuthUserFile /home/moddersinccom/public_html/.staccess
</Files>
# -------------------------------------------
# End of NukeSentinel(tm) admin.php Auth
# -------------------------------------------



<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE text/javascript
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
</IfModule>

# deny most common except .php
<FilesMatch "\\.(inc|tpl|h|ihtml|sql|ini|conf|class|bin|spd|theme|module)$">
deny from all
</FilesMatch>

<Limit GET PUT POST>
  Order Allow,Deny
  Allow from all
</Limit>



<IfModule mod_rewrite.c>

# Enable rewrite engine
RewriteEngine On

#Testing


#RewriteRules

RewriteRule ^reviews-story--(.+).html modules.php?name=NDReviews&op=Story&reid=$1 [nc]
RewriteRule ^reviews-story-1-(.+).html modules.php?name=NDReviews&op=Story&reid=$1 [nc]
RewriteRule ^reviews-story-2-(.+).html modules.php?name=NDReviews&op=Story&reid=$1 [nc]
RewriteRule ^reviews-story-3-(.+).html modules.php?name=NDReviews&op=Story&reid=$1 [nc]
RewriteRule ^reviews-story-4-(.+).html modules.php?name=NDReviews&op=Story&reid=$1 [nc]
RewriteRule ^reviews-story-5-(.+).html modules.php?name=NDReviews&op=Story&reid=$1 [nc]
RewriteRule ^reviews-print-(.+).html modules.php?name=NDReviews&file=print&reid=$1 [nc]
RewriteRule ^howto-story--(.+).html modules.php?name=NDHow-To&op=Story&ndht_id=$1 [nc]
RewriteRule ^how-to-story--(.+).html modules.php?name=NDHow-To&op=Story&ndht_id=$1 [nc]
RewriteRule ^contest-(.+).html modules.php?name=NDContest&op=Contest&ndcon_id=$1 [nc]

RewriteRule ^ftopic-(t|p)-([0-9]*).html modules.php?name=Forums&file=viewtopic&$1=$2 [L]
RewriteRule ^ftopic(t|p)-([0-9]*).html modules.php?name=Forums&file=viewtopic&$1=$2 [L]
RewriteRule ^ftopic-([0-9]*)-([0-9]*).html modules.php?name=Forums&file=viewtopic&t=$1&start=$2 [L]



</IfModule>



#404 error page
ErrorDocument 404 /404.php

#Permanent 301 rewrite
RewriteEngine On

# Redirect non-www urls to www
 RewriteCond %{HTTP_HOST} !^www\\.modders-inc\\.com
 RewriteRule (.*) http://www.modders-inc.com/$1 [R=301,L]

#Redirect all old forum links to new forum start page
RewriteCond %{QUERY_STRING} name=Forums
RewriteRule ^modules.php$ http://www.modders-inc.com/forums/index.php [L,R=301]

# Had to do this because FF would add .php to non www on the site
#RedirectPermanent /.php http://www.modders-inc.com
RedirectPermanent /index.htm http://www.modders-inc.com/index.php

#misc
RedirectPermanent /ndreviewsfeed.php http://www.modders-inc.com/NDReviewsFeed.php



#reviews
RedirectPermanent /reviews.html http://www.modders-inc.com/modules.php?name=NDReviews
RedirectPermanent /reviews-story-5-174.html http://www.modders-inc.com/modules.php?name=NDReviews&op=Story5&reid=174
RedirectPermanent /reviews-story-5-161.html http://www.modders-inc.com/modules.php?name=NDReviews&op=Story&reid=161
RedirectPermanent /reviews-story--151.html http://www.modders-inc.com/modules.php?name=NDReviews&op=Story&reid=151
RedirectPermanent /reviews-story--135.html http://www.modders-inc.com/modules.php?name=NDReviews&op=Story&reid=135
RedirectPermanent /reviews-story--79.html http://www.modders-inc.com/modules.php?name=NDReviews&op=Story&reid=79
RedirectPermanent /reviews-story--111.html http://www.modders-inc.com/modules.php?name=NDReviews&op=Story&reid=111
RedirectPermanent /reviews-story--124.html http://www.modders-inc.com/modules.php?name=NDReviews&op=Story&reid=124
RedirectPermanent /reviews-story--73.html http://www.modders-inc.com/modules.php?name=NDReviews&op=Story&reid=73
RedirectPermanent /reviews-story--102.html http://www.modders-inc.com/modules.php?name=NDReviews&op=Story&reid=102
RedirectPermanent /reviews-story--174.html http://www.modders-inc.com/modules.php?name=NDReviews&op=Story&reid=174
RedirectPermanent /reviews-story--173.html http://www.modders-inc.com/modules.php?name=NDReviews&op=Story&reid=173
RedirectPermanent /reviews-story--121.html http://www.modders-inc.com/modules.php?name=NDReviews&op=Story&reid=121
RedirectPermanent /reviews-story--44.html http://www.modders-inc.com/modules.php?name=NDReviews&op=Story&reid=44
RedirectPermanent /reviews-story--143.html http://www.modders-inc.com/modules.php?name=NDReviews&op=Story&reid=143
RedirectPermanent /reviews-story--99.html http://www.modders-inc.com/modules.php?name=NDReviews&op=Story&reid=99
RedirectPermanent /reviews-story--148.html http://www.modders-inc.com/modules.php?name=NDReviews&op=Story&reid=148
RedirectPermanent /reviews-story--155.html http://www.modders-inc.com/modules.php?name=NDReviews&op=Story&reid=155
RedirectPermanent /reviews-story--98.html http://www.modders-inc.com/modules.php?name=NDReviews&op=Story&reid=98
RedirectPermanent /reviews-story--60.html http://www.modders-inc.com/modules.php?name=NDReviews&op=Story&reid=60
RedirectPermanent /reviews-story--134.html http://www.modders-inc.com/modules.php?name=NDReviews&op=Story&reid=134
RedirectPermanent /reviews-story-5-147.html http://www.modders-inc.com/modules.php?name=NDReviews&op=Story&reid=147
RedirectPermanent /reviews-story-5-138.html http://www.modders-inc.com/modules.php?name=NDReviews&op=Story&reid=138
RedirectPermanent /reviews-story-5-170.html http://www.modders-inc.com/modules.php?name=NDReviews&op=Story&reid=170
RedirectPermanent /reviews-story-4-25.html http://www.modders-inc.com/modules.php?name=NDReviews&op=Story&reid=25
RedirectPermanent /modules.p...Story&reid=303 http://www.modders-inc.com/modules.php?name=NDReviews&op=Story&reid=303


#modules

#Contest
RedirectPermanent /contest.html http://www.modders-inc.com/modules.php?name=NDContest
RedirectPermanent /contest-1.html http://www.modders-inc.com/modules.php?name=NDContest
RedirectPermanent /contest-2.html http://www.modders-inc.com/modules.php?name=NDContest
RedirectPermanent /contest-3.html http://www.modders-inc.com/modules.php?name=NDContest


#html
RedirectPermanent /staffpage-3-Tazz.html http://www.modders-inc.com/modules.php?name=About_Us&op=StaffPage&asname=Tazz
RedirectPermanent /worklog-story--1.html http://www.modders-inc.com/modules.php?name=NDWorklogs&op=Story&ndwl_id=1
RedirectPermanent /downloads-cat6.html http://www.modders-inc.com/modules.php?name=Software
RedirectPermanent /psu-calculator.html http://www.modders-inc.com/modules.php?name=Tools
RedirectPermanent /modules.php/a></psu-calculator.html http://www.modders-inc.com/modules.php?name=Tools
RedirectPermanent /site-info.html http://www.modders-inc.com/modules.php?name=About_Us
RedirectPermanent /how-to.html http://www.modders-inc.com/modules.php?name=NDHow-To
RedirectPermanent /led-res-calculator.html http://www.modders-inc.com/modules.php?name=Tools&op=LEDResistorCalculator
RedirectPermanent /how-to-story-4-10.html http://www.modders-inc.com/modules.php?name=NDHow-To&op=Story&ndht_id=10
RedirectPermanent /forum-15.html http://moddersinc.com/modules.php?name=Forums&file=viewforum&f=14
RedirectPermanent /content-4.html http://www.modders-inc.com/modules.php?name=NDArticles&op=Story&ndar_id=745
RedirectPermanent /interviews.html http://www.modders-inc.com/modules.php?name=Interviews
RedirectPermanent /affiliates.html http://www.modders-inc.com/modules.php?name=Affiliates
RedirectPermanent /news.html http://www.modders-inc.com/modules.php?name=News
RedirectPermanent /userinfo-Americanfreak.html http://www.modders-inc.com/modules.php?name=Forums&file=profile&mode=viewprofile&u=5
RedirectPermanent /userinfo-Tazz.html http://www.modders-inc.com/modules.php?name=Forums&file=profile&mode=viewprofile&u=2
RedirectPermanent /modules/NDReviews/images/ThermalTake_Armor_MX/TT_Armor_MX007_1.jpg http://www.modders-inc.com//modules/NDReviews/images/ThermalTake_ArmorMX.jpg
RedirectPermanent /how-to-story--15.html http://www.modders-inc.com/modules.php?name=NDHow-To&op=Story&ndht_id=15
RedirectPermanent /recognition-story--1.html http://www.modders-inc.com/modules.php?name=Recognition&op=Story&rgid=1
RedirectPermanent /resistor-guide.html http://www.modders-inc.com/modules.php?name=Tools&op=ResistorGuide
RedirectPermanent /featured-rigs.html /modules.php?name=Featured_Rigs
RedirectPermanent /modding101-story--4.html http://www.modders-inc.com/modules.php?name=Mod_101&op=Story&mdid=4
RedirectPermanent /modding101-story--2.html http://www.modders-inc.com/modules.php?name=Mod_101&op=Story&mdid=2

#unknown errors
RedirectPermanent /spaw/empty.html http://www.modders-inc.com
RedirectPermanent /spaw/spaw/empty.html http://www.modders-inc.com
RedirectPermanent /modules.p...Story&reid=340 http://www.modders-inc.com/modules.php?name=NDReviews&op=Story&reid=340
RedirectPermanent /mod http://www.modders-inc.com/modules.php?name=NDReviews
RedirectPermanent /spaw/psu-calculator.html http://www.modders-inc.com/modules.php?name=Tools
RedirectPermanent /modules.php/a></psu-calculator.html http://www.modders-inc.com/modules.php?name=Tools
RedirectPermanent /modules.php/a></www.zalmanusa.com http://www.zalmanusa.com
RedirectPermanent /modules.php/a></www.coolitsystems.com/dalc http://www.coolitsystems.com/dalc
RedirectPermanent /modules.php/a></www.soundblaster.com http://www.soundblaster.com
RedirectPermanent /modules.php/modders-inc.com/empty.html http://www.modders-inc.com
RedirectPermanent /www.soundblaster.com http://www.soundblaster.com
RedirectPermanent /www.logitech.com http://www.logitech.com

You might benefit from reading the mod_rewrite tutorial linked in my signature as it contains explanations and sample code. It’s helped may members and should help you, too.

Regards,

DK