This .htaccess will do it :
- Code: Select all
# Lines That should already be in your .htacess
<Files "config.php">
Order Allow,Deny
Deny from All
</Files>
<Files "common.php">
Order Allow,Deny
Deny from All
</Files>
# You may need to un-comment the following line
# Options +FollowSymlinks
# REMEBER YOU ONLY NEED TO STARD MOD REWRITE ONCE
RewriteEngine On
# REWRITE BASE
RewriteBase /
# HERE IS A GOOD PLACE TO ADD THE WWW PREFIXE REDIRECTION
#umleiten auf roqbar.de
RewriteCond %{HTTP_HOST} !^www\.roqbar\.de$
RewriteRule ^(.*)$ http://www.roqbar.de/$1 [L,R=301]
#####################################################
# PHPBB SEO REWRITE RULES - ADVANCED
#####################################################
# AUTHOR : dcz www.phpbb-seo.com
# STARTED : 01/2006
#################################
# FORUMS PAGES
###############
# FORUM INDEX REWRITERULE WOULD STAND HERE IF USED. 'forum' REQUIRES TO BE SET AS FORUM INDEX
# RewriteRule ^(new_dir/)?forum\.html$ /new_dir/index.php [QSA,L,NC]
# FORUM
RewriteRule ^(new_dir/)?[a-z0-9_-]*-f([0-9]+)(-([0-9]+))?\.html$ /new_dir/viewforum.php?f=$2&start=$4 [QSA,L,NC]
# TOPIC WITH VIRTUAL FOLDER
RewriteRule ^(new_dir/)?[a-z0-9_-]*-f([0-9]+)/[a-z0-9_-]*-t([0-9]+)(-([0-9]+))?\.html$ /new_dir/viewtopic.php?f=$2&t=$3&start=$5 [QSA,L,NC]
# GLOBAL ANNOUNCES WITH VIRTUAL FOLDER
RewriteRule ^(new_dir/)?bekanntmachung/[a-z0-9_-]*-t([0-9]+)(-([0-9]+))?\.html$ /new_dir/viewtopic.php?t=$2&start=$4 [QSA,L,NC]
# TOPIC WITHOUT FORUM ID & DELIM
RewriteRule ^(new_dir/)?[a-z0-9_-]*/?[a-z0-9_-]*-t([0-9]+)(-([0-9]+))?\.html$ /new_dir/viewtopic.php?t=$2&start=$4 [QSA,L,NC]
# PROFILES THROUGH USERNAME
RewriteRule ^(new_dir/)?benutzer/([^/]+)/?$ /new_dir/memberlist.php?mode=viewprofile&un=$2 [QSA,L,NC]
# USER MESSAGES THROUGH USERNAME
RewriteRule ^(new_dir/)?nachrichten/([^/]+)/?(seite([0-9]+)\.html)?$ /new_dir/search.php?author=$2&sr=posts&start=$4 [QSA,L,NC]
# GROUPS ADVANCED
RewriteRule ^(new_dir/)?[a-z0-9_-]*-g([0-9]+)(-([0-9]+))?\.html$ /new_dir/memberlist.php?mode=group&g=$2&start=$4 [QSA,L,NC]
# POST
RewriteRule ^(new_dir/)?post([0-9]+)\.html$ /new_dir/viewtopic.php?p=$2 [QSA,L,NC]
# THE TEAM
RewriteRule ^(new_dir/)?staff\.html$ /new_dir/memberlist.php?mode=leaders [QSA,L,NC]
# HERE IS A GOOD PLACE TO ADD OTHER PHPBB RELATED REWRITERULES
# FORUM WITHOUT ID & DELIM
# THESE FOUR LINES MUST BE LOCATED AT THE END OF YOUR HTACCESS TO WORK PROPERLY
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^(new_dir/)?[a-z0-9_-]+(-([0-9]+))?\.html$ /new_dir/viewforum.php?start=$3 [QSA,L,NC]
# END PHPBB PAGES
#####################################################
I moved the www prefix redirection at a better place, and only kept the second set, since it's enough for all cases for your setup.
You will need to run this .htaccess at the root level to be able to catch the previous URI from this level. This means that the virtual root option could be a solution, you'd keep the same urls for the forum, but it would be installed in a sub dir. Because you'll still need to merge the phpBB's .htaccess with the eventual other one form other application if you move phpBB.
Then, you'll have to replace new_dir/ with the actual dir you elected. All I did was to conditionally add the path in the left part of the rewriterule ( (new_dir/)? ) so that both new_dir/url and url will hit the proper script, the zero duplicate doing the rest.
Path is added the regular way in the right part of the rewriterules, but the conditional firt one requires that we add +1 to the var name sent to the script, eg :
- Code: Select all
/memberlist.php?mode=viewprofile&un=$1 [QSA,L,NC]
vs
- Code: Select all
/new_dir/memberlist.php?mode=viewprofile&un=$2 [QSA,L,NC]
To test this, you can first copy phpBB to the new dir and validate the .htaccess, and then, delete the files at the root level. You'll have to update phpBB config for th new script path as well.
++