Board migrated to subfolder

Discussions about the phpBB3 Forum. How to get the best from this powerful script.
Note that there is no official support for phpBB3 here, a place to share more than to ask for.

Moderator: Moderators

Board migrated to subfolder

Postby frechdaxx » Fri Jan 11, 2008 2:26 pm

hey,

I moved my board from my root folder to a subfolder named /community. Is there a way to redirect every visitor to the subfolder? I have done it the other way with a htaccess:

Redirect /board http://www.roqbar.de/

which redirected every visit from the subfolder to the root, but

Redirect / http://www.roqbar.de/community

doesn't work..Anyone an idea?
frechdaxx
 
Posts: 20
Joined: Tue Sep 04, 2007 7:58 pm

Advertisement

Postby dcz » Sun Jan 13, 2008 8:43 pm

Before you do so, you should think well, especially if you did it the other way around recently.
You should not redirect all your forum too often, could end up confusing SEs.

Then, it depends on if you do this to add new pages at the root level or if you only want (but this would not be a good idea SEO wise) to move the forum.

The problem redirecting this way is you cannot redirect all the call to the root to the forum dir if you want to still be able to use the root level for other pages.

A solution would be to redirect more accurately, using the forums rewriterules.
Knowing this, please confirm your wish, and if you still want to, post your .htaccess here, and I'll tell you how to proceed.

++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21291
Joined: Fri Apr 28, 2006 9:03 pm

Postby frechdaxx » Mon Jan 14, 2008 7:46 pm

I'm thinking about a bridge for phpbb, maybe with drupal oder lotus core (which is down atm) because I won't do that now, I thought to redirect the forum links, so that google can index everything. So long I can't use the root, which doesn't matter, because I want to wait with a cms anyway ;) If redirecting and using the root can be done it would be perfect ;) Currently the forum is still in the root. The htaccess is:

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

    #####################################################
    # 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 ^forum\.html$ /index.php [QSA,L,NC]
    # FORUM
    RewriteRule ^[a-z0-9_-]*-f([0-9]+)(-([0-9]+))?\.html$ /viewforum.php?f=$1&start=$3 [QSA,L,NC]
    # TOPIC WITH VIRTUAL FOLDER
    RewriteRule ^[a-z0-9_-]*-f([0-9]+)/[a-z0-9_-]*-t([0-9]+)(-([0-9]+))?\.html$ /viewtopic.php?f=$1&t=$2&start=$4 [QSA,L,NC]
    # GLOBAL ANNOUNCES WITH VIRTUAL FOLDER
    RewriteRule ^bekanntmachung/[a-z0-9_-]*-t([0-9]+)(-([0-9]+))?\.html$ /viewtopic.php?t=$1&start=$3 [QSA,L,NC]
    # TOPIC WITHOUT FORUM ID & DELIM
    RewriteRule ^[a-z0-9_-]*/?[a-z0-9_-]*-t([0-9]+)(-([0-9]+))?\.html$ /viewtopic.php?t=$1&start=$3 [QSA,L,NC]
    # PROFILES THROUGH USERNAME
    RewriteRule ^benutzer/([^/]+)/?$ /memberlist.php?mode=viewprofile&un=$1 [QSA,L,NC]
    # USER MESSAGES THROUGH USERNAME
    RewriteRule ^nachrichten/([^/]+)/?(seite([0-9]+)\.html)?$ /search.php?author=$1&sr=posts&start=$3 [QSA,L,NC]
    # GROUPS ADVANCED
    RewriteRule ^[a-z0-9_-]*-g([0-9]+)(-([0-9]+))?\.html$ /memberlist.php?mode=group&g=$1&start=$3 [QSA,L,NC]
    # POST
    RewriteRule ^post([0-9]+)\.html$ /viewtopic.php?p=$1 [QSA,L,NC]
    # THE TEAM
    RewriteRule ^staff\.html$ /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 ^[a-z0-9_-]+(-([0-9]+))?\.html$ /viewforum.php?start=$2 [QSA,L,NC]
    # END PHPBB PAGES
    #####################################################




   
#Umschreiben auf www
RewriteCond %{HTTP_HOST} ^roqbar.de$ [NC]
RewriteRule ^(.*) http://www.roqbar.de/$1 [L,R=301]
#umleiten auf roqbar.de
RewriteCond %{HTTP_HOST} !^www\.roqbar\.de$
RewriteRule ^(.*)$ http://www.roqbar.de/$1 [L,R=301]

frechdaxx
 
Posts: 20
Joined: Tue Sep 04, 2007 7:58 pm

Postby dcz » Wed Jan 16, 2008 1:41 pm

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.

++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21291
Joined: Fri Apr 28, 2006 9:03 pm

Postby frechdaxx » Sun Jan 20, 2008 2:22 pm

Thx a lot, I will test this when I finally migrate to a subfolder, first I'm going to use a portal until the drupal bridge will become more stable.

--> Bookmarked ;)
frechdaxx
 
Posts: 20
Joined: Tue Sep 04, 2007 7:58 pm


Return to phpBB Forum

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: Bing [Bot] and 93 guests