Need post install rewrite rules for phpbb2Drupal module
mainmac - November 15, 2006 - 14:10
| Project: | phpBB2Drupal |
| Version: | 5.x-3.x-dev |
| Component: | Code |
| Category: | support request |
| Priority: | normal |
| Assigned: | ponrajasekar |
| Status: | closed |
Description
I've found a number of my phpbb2 links are in Google and get a "Page not found error"
example:
http://www.site.com/phpbb2/viewtopic.php?p=14097&sid=68c0a96c26662dda7d5...
I need this to rewrite to:
http://www.site.com/forum
Thanks
BTW VERY nice job on the conversion script....convert 2700+ users to 33K posts.
Only got 1 error message (user name collision).
Error message could be better for this but I'm NOT complaining!
I've tried the root .htaccess adding
RewriteRule ^phpbb2\/(.*)$ http://www.site.com/forum [R=301,L]
But this doesnt seems to work.
Thanks
Wayne

#1
I am using clean URL's....
I finally got this to work:
created a drupal_install_dirphpbb2 subdir
then I copied the default .htaccess into the /phpbb2 subdirectory with these changes:
# Various rewrite rules.
<IfModule mod_rewrite.c>
RewriteEngine on
# If your site can be accessed both with and without the prefix www.
# you can use one of the following settings to force user to use only one option:
#
# If you want the site to be accessed WITH the www. only, adapt and uncomment the following:
# RewriteCond %{HTTP_HOST} !^www\.example\.com$ [NC]
# RewriteRule .* http://www.example.com/ [L,R=301]
#
# If you want the site to be accessed only WITHOUT the www. , adapt and uncomment the following:
# RewriteCond %{HTTP_HOST} !^example\.com$ [NC]
# RewriteRule .* http://example.com/ [L,R=301]
# Modify the RewriteBase if you are using Drupal in a subdirectory and
# the rewrite rules are not working properly.
RewriteBase /phpbb2
RewriteRule . /forum [R=301,L]
# Rewrite old-style URLs of the form 'node.php?id=x'.
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{QUERY_STRING} ^id=([^&]+)$
#RewriteRule node.php index.php?q=node/view/%1 [L]
# Rewrite old-style URLs of the form 'module.php?mod=x'.
#RewriteCond %{REQUEST_FILENAME} !-f
#RewriteCond %{REQUEST_FILENAME} !-d
#RewriteCond %{QUERY_STRING} ^mod=([^&]+)$
#RewriteRule module.php index.php?q=%1 [L]
# Rewrite current-style URLs of the form 'index.php?q=x'.
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
# wam - Custom to redirect phpbb from old site
# RewriteCond %{QUERY_STRING} ^p=(/d+)$
RewriteRule . /forum [R=301,L]
</IfModule>
this passes the entire query string (which is ok) and puts the user into the forum main page.
#2
#3
#4
Hello.
I am trying to do the very same thing with my site (old phpbb was on /forum and the new site is on /sajt/forum).
I used to know how to make rewrite rules, but it was a long time ago, and now I'm totally confused.
I know that rewrite rules that I've put in my webroot are working, but the rules I've added for the forum are just not working.
I don't see any errors in apache log.
I am not absolutely sure what is the "." in front of "forum" is supposed to mean in the second RewriteRule?
And I don't understand the purpose of f.txt file (seems like a regular drupal html output).
This is what I've done so far (doesn't work) :(
In the .htaccess of the /forum folder
RewriteEngine on
RewriteBase /forum
RewriteRule /sajt/forum [R=301,L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]
RewriteRule /sajt/forum [R=301,L]
Is there any way to debug this? (I am on a shared hosting, and do not have access to php.ini).
Can someone please help me make this work?
Thanks in advance...
And sorry for my rusty English!
Best regards,
Milan
ps: I am using the 5.x-3.x-dev version, if it makes a difference.
#5
Is a simple redirect not enough? Something like
Redirect /forum http://www.example.com/sajt/forumin the htaccess file?
#6
Thank you for your fast reply.
This is working actually, but as I understood, it is possible to redirect a post or a topic using this conversion tool. That is why I try to make a complicated version of Redirect.
Edit: I've had a chance of testing it, and it's working for forums! :)
I haven't tested it on topics, but that's not that important..
Thank you!! :)
#7
phpBB_Redirect will only work to redirect from within the Drupal directory, and even then it is hard wired to redirect the in the forum directory only, where any link to the old viewtopic.php or viewforum.php is redirected.
From reading your post, I assume your old forum directory is outside the drupal directory? (the Drupal directory being "sajt/"). For things to work, you will need both phpBB Redirect, and a redirect from the old directory to the new directory.
What will happen is:
1. Someone will try to access old forum link
2, Apache will redirect to the new forum link
3. phpBB_Redirect will redirect to the correct forum/directory depending on what the url was.
#8
closing old issues that are probably no longer relevant.