Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff
Author Message
p17blo
Regular
Regular


Joined: Jul 27, 2007
Posts: 77

PostPosted: Mon Aug 27, 2007 4:48 pm Reply with quote

Hi,

I am just migrating from PHPBB to Nuke. Everything is moved across fine but as I am heavily indexed by Google I want to redirect any people coming to the site from the old PHPBB forum to the new nuke integrated forum using mod rewrite.

I already have some rewriting going on so I know that the rewrite engine works. Everything was installed in standard paths for both PHPBB and nuke So I firstly added the following to .htaccess in the root of the site as follows:

Quote:

RewriteRule ^forum/viewtopic.php?t=([0-9]+) modules.php?name=Forums&file=viewtopic&t=$1 [L]


This didn't do anything - I made a few changes because I wasn't sure about special characters and ended up with this:

Quote:

RewriteRule ^forum/viewtopic.php\?t\=([0-9]+) modules.php\?name\=Forums\&file\=viewtopic\&t\=$1 [L]


And that didn't work either.

I did try similar entries in the subfolder forum from the old PHPBB but this was no go also.

Can anyone see what I have done wrong?

And for completeness the top lines of my .htaccess file is
RewriteEngine on

Paul
 
View user's profile Send private message
evaders99
Former Moderator in Good Standing


Joined: Apr 30, 2004
Posts: 3221

PostPosted: Mon Aug 27, 2007 6:32 pm Reply with quote

RewriteRule itself does not process the variables of the URL.
So you must create a RewriteCond to test it, along with the QSA paramater on the RewriteRule to pass the variables themselves. (Yea I had to look this up)


This works for me
Code:


RewriteCond %{QUERY_STRING} t=([0-9]+)
RewriteRule ^forum/viewtopic.php modules.php ?name=Forums&file=viewtopic&t=$1 [QSA,L]


(Note: remove the space between modules.php ? - this was done to bypass the url rewrite on this forum)

_________________
- Only registered users can see links on this board! Get registered or login! -

Need help? Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
p17blo
PostPosted: Tue Aug 28, 2007 12:05 am Reply with quote

Thanks evaders, Through sheer persistance I already came up with something similar - Here is my code:

Code:


RewriteCond %{QUERY_STRING} ^t=(.*)$
RewriteRule ^viewtopic.php$ http://www.mydomain.com/modules.php ?name=Forums&file=viewtopic&t=%1 [R,L]


This was placed in the forum subfolder and the [R] was needed to force the url bar to change.

Notice mine is missing QSA, do you know what that does?

I think your code is probably a little more secure based on the variable selection

This is still a massive learning curve for me.

Paul
 
montego
Site Admin


Joined: Aug 29, 2004
Posts: 9449
Location: Arizona

PostPosted: Tue Aug 28, 2007 6:07 am Reply with quote

I think, though, that you will want R=301 to tell the search engines that these pages have permanently moved?

_________________
Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> General/Other Stuff

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©