Help me to redirect

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

Help me to redirect

Postby algs163 » Sun Nov 30, 2008 3:18 am

Hi, how are you?
Well i need help!

i have a phpBB3 forum with Advanced Mod Rewrite 0.4.6 and gym sitemaps 2.0

It's ok, but my forum is in the root, and i need to move the forum into a folder in the root.
BUT, i don't want to lose my position in Search Engines, so, what can i do?

The thing i want: For example:
if i enter to http://www.zonalterna.com/sistemas-operativos-f49.html
i should redirect to http://www.zonalterna.com/foros/sistema ... s-f49.html automatically.
And, if i enter to http://www.zonalterna.com/, i should redirect to http://www.zonalterna.com/index.php (could be the portal)

What can i put in the .htaccess?
I need it because i want to put the mkportal with my phpBB3 forum.

Please, help me
Thank you very much.

Greetings,
algs163
 
Posts: 4
Joined: Sun Nov 30, 2008 3:06 am

Advertisement

Postby SeO » Sun Nov 30, 2008 11:14 am

This is pretty easy to do, but you could as well think about using the virtual root option.

This option would allow you to move the forum to the foros/ dir without changing the rewritten urls to your forum.

Or you could just :
  1. edit your current root .htaccess to add the foros/ path in the right part of the rewriterules :
    Code: Select all
    RewriteRule ^forum\.html$ /index.php [QSA,L,NC]

    becomes :
    Code: Select all
    RewriteRule ^forum\.html$ /foros/index.php [QSA,L,NC]

    and so on.
  2. move your forum to foros/ and update the phpBB config accordingly (script path)
  3. generate a new .htaccess for this new set up, but after you have activated the "more options" option and selected "alternate location".
    This is to generate a .htaccess meant to be used in the foroS/ dir for phpBB3.


The .htaccess in domain's root, the one you'd have edited, would allow example.com/forum.html to work in foros/forum.html, but the zero duplicate would then redirect this to example.com/foros/forum.html with an HTTP 301 header, and the second .htaccess would make it work as expected ;)

Same for all other phpBB3 rewriterules.

I off course encourage you to test this offline before you go online, just to make sure you won't block you site for a missing slash in .htaccess ;)
SeO
Admin
Admin
 
Posts: 6334
Joined: Wed Mar 15, 2006 9:41 pm

Postby algs163 » Sun Nov 30, 2008 7:49 pm

thanks for your reply.
but it doesnt run :(
i did all and it doesnt redirect :S
i have installed the zero duplicate mod too. but the same :S
what can i do?
greetings,
algs163
 
Posts: 4
Joined: Sun Nov 30, 2008 3:06 am

Postby algs163 » Sun Nov 30, 2008 11:52 pm

sorry
now, it's correct

www.zonalterna.com/sistemas-operativos-f49.html
its ok

but if you are in www.zonalterna.com/foros
you can see that when you enter in a foro, you have an error :S
The forum doesn't exiist :S:S:S

.htaccess in root (www.zonalterna.com)

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 lines
# Options +FollowSymlinks
# To make sure that rewritten dir or file (/|.html) will not load dir.php in case it exist
# Options -MultiViews
# REMEBER YOU ONLY NEED TO STARD MOD REWRITE ONCE
RewriteEngine On
# REWRITE BASE
RewriteBase /foros/
# 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 ^announces/[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?forum_uri=$1&t=$2&start=$4 [QSA,L,NC]
# PROFILES ADVANCED
RewriteRule ^[a-z0-9_-]*-u([0-9]+)\.html$ memberlist.php?mode=viewprofile&u=$1 [QSA,L,NC]
# USER MESSAGES ADVANCED
RewriteRule ^[a-z0-9_-]*-u([0-9]+)-(topics|posts)(-([0-9]+))?\.html$ search.php?author_id=$1&sr=$2&start=$4 [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]
# ACTIVE TOPICS
RewriteRule ^active-topics(-([0-9]+))?\.html$ search.php?search_id=active_topics&start=$2&sr=topics [QSA,L,NC]
# UNANSWERED TOPICS
RewriteRule ^unanswered(-([0-9]+))?\.html$ search.php?search_id=unanswered&start=$2&sr=topics [QSA,L,NC]
# NEW POSTS
RewriteRule ^newposts(-([0-9]+))?\.html$ search.php?search_id=newposts&start=$2&sr=topics [QSA,L,NC]
# THE TEAM
RewriteRule ^the-team\.html$ memberlist.php?mode=leaders [QSA,L,NC]
# HERE IS A GOOD PLACE TO ADD OTHER PHPBB RELATED REWRITERULES

#####################################################
# GYM Sitemaps & RSS
# Global channels
# NOTE : THE FOLLOWING REWRITERULE IS LEFT COMMENTED BECAUSE IT CANNOT
# BE IMPLEMENTED IN THIS .HTACCESS, BUT RATHER IN AN ABOVE ONE
# WITH PROPER SLASHES AND PATHS
# RewriteRule ^rss(/(news)+)?(/(digest)+)?(/(short|long)+)?/?$ gymrss.php?channels&$2&$4&$6 [QSA,L,NC]
# HTML Global news & maps
# NOTE : THE FOLLOWING REWRITERULE IS LEFT COMMENTED BECAUSE IT CANNOT
# BE IMPLEMENTED IN THIS .HTACCESS, BUT RATHER IN AN ABOVE ONE
# WITH PROPER SLASHES AND PATHS
# RewriteRule ^(news|maps)/?(page([0-9]+)\.html)?$ map.php?$1&start=$3 [QSA,L,NC]
# END GYM Sitemaps & RSS
#####################################################

# FORUM WITHOUT ID & DELIM
# THESE FOUR LINES MUST BE LOCATED AT THE END OF YOUR HTACCESS TO WORK PROPERLY
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-z0-9_-]+)(-([0-9]+))\.html$ viewforum.php?forum_uri=$1&start=$3 [QSA,L,NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([a-z0-9_-]+)\.html$ viewforum.php?forum_uri=$1 [QSA,L,NC]
# END PHPBB PAGES
#####################################################

#####################################################
# GYM Sitemaps & RSS
# HTML Module additional modes
# NOTE : THE FOLLOWING REWRITERULE IS LEFT COMMENTED BECAUSE IT CANNOT
# BE IMPLEMENTED IN THIS .HTACCESS, BUT RATHER IN AN ABOVE ONE
# WITH PROPER SLASHES AND PATHS
# RewriteRule ^(news|maps)/([a-z0-9_-]+)(/([a-z0-9_-]+))?/?(page([0-9]+)\.html)?$ map.php?$2=$4&$1&start=$6 [QSA,L,NC]
# Main feeds & channels
# NOTE : THE FOLLOWING REWRITERULE IS LEFT COMMENTED BECAUSE IT CANNOT
# BE IMPLEMENTED IN THIS .HTACCESS, BUT RATHER IN AN ABOVE ONE
# WITH PROPER SLASHES AND PATHS
# RewriteRule ^rss(/(news)+)?(/(digest)+)?(/(short|long)+)?(/([a-z0-9_-]+))?/([a-z0-9_]+)\.xml(\.gz)?$ gymrss.php?$9=$8&$2&$4&$6&gzip=$10 [QSA,L,NC]
# Module feeds
# NOTE : THE FOLLOWING REWRITERULE IS LEFT COMMENTED BECAUSE IT CANNOT
# BE IMPLEMENTED IN THIS .HTACCESS, BUT RATHER IN AN ABOVE ONE
# WITH PROPER SLASHES AND PATHS
# RewriteRule ^[a-z0-9_-]*-[a-z]+([0-9]+)(/(news)+)?(/(digest)+)?(/(short|long)+)?/([a-z0-9_]+)\.xml(\.gz)?$ gymrss.php?$8=$1&$3&$5&$7&gzip=$9 [QSA,L,NC]
# Module feeds without ids
# NOTE : THE FOLLOWING REWRITERULE IS LEFT COMMENTED BECAUSE IT CANNOT
# BE IMPLEMENTED IN THIS .HTACCESS, BUT RATHER IN AN ABOVE ONE
# WITH PROPER SLASHES AND PATHS
# RewriteRule ^([a-z0-9_-]+)(/(news)+)?(/(digest)+)?(/(short|long)+)?/([a-z0-9_]+)\.xml(\.gz)?$ gymrss.php?nametoid=$1&$3&$5&$7&modulename=$8&gzip=$9 [QSA,L,NC]
# Google SitemapIndex
# NOTE : THE FOLLOWING REWRITERULE IS LEFT COMMENTED BECAUSE IT CANNOT
# BE IMPLEMENTED IN THIS .HTACCESS, BUT RATHER IN AN ABOVE ONE
# WITH PROPER SLASHES AND PATHS
# RewriteRule ^sitemapindex\.xml(\.gz)?$ sitemap.php?gzip=$1 [QSA,L,NC]
# Module cat sitemaps
# NOTE : THE FOLLOWING REWRITERULE IS LEFT COMMENTED BECAUSE IT CANNOT
# BE IMPLEMENTED IN THIS .HTACCESS, BUT RATHER IN AN ABOVE ONE
# WITH PROPER SLASHES AND PATHS
# RewriteRule ^[a-z0-9_-]+-([a-z]+)([0-9]+)\.xml(\.gz)?$ sitemap.php?module_sep=$1&module_sub=$2&gzip=$3 [QSA,L,NC]
# Module sitemaps
# NOTE : THE FOLLOWING REWRITERULE IS LEFT COMMENTED BECAUSE IT CANNOT
# BE IMPLEMENTED IN THIS .HTACCESS, BUT RATHER IN AN ABOVE ONE
# WITH PROPER SLASHES AND PATHS
# RewriteRule ^([a-z0-9_]+)-([a-z0-9_-]+)\.xml(\.gz)?$ sitemap.php?$1=$2&gzip=$3 [QSA,L,NC]
# END GYM Sitemaps & RSS
#####################################################


.htaccess in /foros (www.zonalterna.com/foros)

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 lines
# Options +FollowSymlinks
# To make sure that rewritten dir or file (/|.html) will not load dir.php in case it exist
# Options -MultiViews
# 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 ^foros/forum\.html$ /foros/index.php [QSA,L,NC]
# FORUM
RewriteRule ^foros/[a-z0-9_-]*-f([0-9]+)(-([0-9]+))?\.html$ /foros/viewforum.php?f=$1&start=$3 [QSA,L,NC]
# TOPIC WITH VIRTUAL FOLDER
RewriteRule ^foros/[a-z0-9_-]*-f([0-9]+)/[a-z0-9_-]*-t([0-9]+)(-([0-9]+))?\.html$ /foros/viewtopic.php?f=$1&t=$2&start=$4 [QSA,L,NC]
# GLOBAL ANNOUNCES WITH VIRTUAL FOLDER
RewriteRule ^foros/announces/[a-z0-9_-]*-t([0-9]+)(-([0-9]+))?\.html$ /foros/viewtopic.php?t=$1&start=$3 [QSA,L,NC]
# TOPIC WITHOUT FORUM ID & DELIM
RewriteRule ^foros/([a-z0-9_-]*)/?[a-z0-9_-]*-t([0-9]+)(-([0-9]+))?\.html$ /foros/viewtopic.php?forum_uri=$1&t=$2&start=$4 [QSA,L,NC]
# PROFILES ADVANCED
RewriteRule ^foros/[a-z0-9_-]*-u([0-9]+)\.html$ /foros/memberlist.php?mode=viewprofile&u=$1 [QSA,L,NC]
# USER MESSAGES ADVANCED
RewriteRule ^foros/[a-z0-9_-]*-u([0-9]+)-(topics|posts)(-([0-9]+))?\.html$ /foros/search.php?author_id=$1&sr=$2&start=$4 [QSA,L,NC]
# GROUPS ADVANCED
RewriteRule ^foros/[a-z0-9_-]*-g([0-9]+)(-([0-9]+))?\.html$ /foros/memberlist.php?mode=group&g=$1&start=$3 [QSA,L,NC]
# POST
RewriteRule ^foros/post([0-9]+)\.html$ /foros/viewtopic.php?p=$1 [QSA,L,NC]
# ACTIVE TOPICS
RewriteRule ^foros/active-topics(-([0-9]+))?\.html$ /foros/search.php?search_id=active_topics&start=$2&sr=topics [QSA,L,NC]
# UNANSWERED TOPICS
RewriteRule ^foros/unanswered(-([0-9]+))?\.html$ /foros/search.php?search_id=unanswered&start=$2&sr=topics [QSA,L,NC]
# NEW POSTS
RewriteRule ^foros/newposts(-([0-9]+))?\.html$ /foros/search.php?search_id=newposts&start=$2&sr=topics [QSA,L,NC]
# THE TEAM
RewriteRule ^foros/the-team\.html$ /foros/memberlist.php?mode=leaders [QSA,L,NC]
# HERE IS A GOOD PLACE TO ADD OTHER PHPBB RELATED REWRITERULES

#####################################################
# GYM Sitemaps & RSS
# Global channels
# NOTE : THE FOLLOWING REWRITERULE IS LEFT COMMENTED BECAUSE IT CANNOT
# BE IMPLEMENTED IN THIS .HTACCESS, BUT RATHER IN AN ABOVE ONE
# WITH PROPER SLASHES AND PATHS
# RewriteRule ^rss(/(news)+)?(/(digest)+)?(/(short|long)+)?/?$ /gymrss.php?channels&$2&$4&$6 [QSA,L,NC]
# HTML Global news & maps
# NOTE : THE FOLLOWING REWRITERULE IS LEFT COMMENTED BECAUSE IT CANNOT
# BE IMPLEMENTED IN THIS .HTACCESS, BUT RATHER IN AN ABOVE ONE
# WITH PROPER SLASHES AND PATHS
# RewriteRule ^(news|maps)/?(page([0-9]+)\.html)?$ /map.php?$1&start=$3 [QSA,L,NC]
# END GYM Sitemaps & RSS
#####################################################

# FORUM WITHOUT ID & DELIM
# THESE FOUR LINES MUST BE LOCATED AT THE END OF YOUR HTACCESS TO WORK PROPERLY
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^foros/([a-z0-9_-]+)(-([0-9]+))\.html$ /foros/viewforum.php?forum_uri=$1&start=$3 [QSA,L,NC]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^foros/([a-z0-9_-]+)\.html$ /foros/viewforum.php?forum_uri=$1 [QSA,L,NC]
# END PHPBB PAGES
#####################################################

#####################################################
# GYM Sitemaps & RSS
# HTML Module additional modes
# NOTE : THE FOLLOWING REWRITERULE IS LEFT COMMENTED BECAUSE IT CANNOT
# BE IMPLEMENTED IN THIS .HTACCESS, BUT RATHER IN AN ABOVE ONE
# WITH PROPER SLASHES AND PATHS
# RewriteRule ^(news|maps)/([a-z0-9_-]+)(/([a-z0-9_-]+))?/?(page([0-9]+)\.html)?$ /map.php?$2=$4&$1&start=$6 [QSA,L,NC]
# Main feeds & channels
# NOTE : THE FOLLOWING REWRITERULE IS LEFT COMMENTED BECAUSE IT CANNOT
# BE IMPLEMENTED IN THIS .HTACCESS, BUT RATHER IN AN ABOVE ONE
# WITH PROPER SLASHES AND PATHS
# RewriteRule ^rss(/(news)+)?(/(digest)+)?(/(short|long)+)?(/([a-z0-9_-]+))?/([a-z0-9_]+)\.xml(\.gz)?$ /gymrss.php?$9=$8&$2&$4&$6&gzip=$10 [QSA,L,NC]
# Module feeds
# NOTE : THE FOLLOWING REWRITERULE IS LEFT COMMENTED BECAUSE IT CANNOT
# BE IMPLEMENTED IN THIS .HTACCESS, BUT RATHER IN AN ABOVE ONE
# WITH PROPER SLASHES AND PATHS
# RewriteRule ^[a-z0-9_-]*-[a-z]+([0-9]+)(/(news)+)?(/(digest)+)?(/(short|long)+)?/([a-z0-9_]+)\.xml(\.gz)?$ /gymrss.php?$8=$1&$3&$5&$7&gzip=$9 [QSA,L,NC]
# Module feeds without ids
# NOTE : THE FOLLOWING REWRITERULE IS LEFT COMMENTED BECAUSE IT CANNOT
# BE IMPLEMENTED IN THIS .HTACCESS, BUT RATHER IN AN ABOVE ONE
# WITH PROPER SLASHES AND PATHS
# RewriteRule ^([a-z0-9_-]+)(/(news)+)?(/(digest)+)?(/(short|long)+)?/([a-z0-9_]+)\.xml(\.gz)?$ /gymrss.php?nametoid=$1&$3&$5&$7&modulename=$8&gzip=$9 [QSA,L,NC]
# Google SitemapIndex
# NOTE : THE FOLLOWING REWRITERULE IS LEFT COMMENTED BECAUSE IT CANNOT
# BE IMPLEMENTED IN THIS .HTACCESS, BUT RATHER IN AN ABOVE ONE
# WITH PROPER SLASHES AND PATHS
# RewriteRule ^sitemapindex\.xml(\.gz)?$ /sitemap.php?gzip=$1 [QSA,L,NC]
# Module cat sitemaps
# NOTE : THE FOLLOWING REWRITERULE IS LEFT COMMENTED BECAUSE IT CANNOT
# BE IMPLEMENTED IN THIS .HTACCESS, BUT RATHER IN AN ABOVE ONE
# WITH PROPER SLASHES AND PATHS
# RewriteRule ^[a-z0-9_-]+-([a-z]+)([0-9]+)\.xml(\.gz)?$ /sitemap.php?module_sep=$1&module_sub=$2&gzip=$3 [QSA,L,NC]
# Module sitemaps
# NOTE : THE FOLLOWING REWRITERULE IS LEFT COMMENTED BECAUSE IT CANNOT
# BE IMPLEMENTED IN THIS .HTACCESS, BUT RATHER IN AN ABOVE ONE
# WITH PROPER SLASHES AND PATHS
# RewriteRule ^([a-z0-9_]+)-([a-z0-9_-]+)\.xml(\.gz)?$ /sitemap.php?$1=$2&gzip=$3 [QSA,L,NC]
# END GYM Sitemaps & RSS
#####################################################
algs163
 
Posts: 4
Joined: Sun Nov 30, 2008 3:06 am

Postby SeO » Mon Dec 01, 2008 9:47 am

SeO wrote:
Code: Select all
RewriteRule ^forum\.html$ /index.php [QSA,L,NC]

becomes :
Code: Select all
RewriteRule ^forum\.html$ /foros/index.php [QSA,L,NC]

and so on.


THis you did not do in the domain's root .htaccess, you as well need to edit the one you have now (before you move the forum to foros/), eg without :
Code: Select all
RewriteBase /foros/


but rather with :
Code: Select all
RewriteBase /
SeO
Admin
Admin
 
Posts: 6334
Joined: Wed Mar 15, 2006 9:41 pm

Postby algs163 » Tue Dec 02, 2008 5:54 am

that's strange
but without did it
it's run!!
test in my website :O

THANK YOU VERY MUCH !!!!
algs163
 
Posts: 4
Joined: Sun Nov 30, 2008 3:06 am


Return to phpBB Forum

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 8 guests