PHP Web Host - Quality Web Hosting For All PHP Applications Clan Themes! We make clans look good!!
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
p17blo
Regular
Regular


Joined: Jul 27, 2007
Posts: 77

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

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]+) forums.html&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 Back to top

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)
View user's profile Send private message Visit poster's website
p17blo
Regular
Regular


Joined: Jul 27, 2007
Posts: 77

PostPosted: Tue Aug 28, 2007 12:05 am Reply with quote Back to top

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
View user's profile Send private message
montego
Site Admin


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

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

I think, though, that you will want R=301 to tell the search engines that these pages have permanently moved?
View user's profile Send private message Visit poster's website
Display posts from previous:       
Post new topic   Reply to topic

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
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2011 by Raven

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::
:: fisubice Theme Modified by the RavenNuke™ Team ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum