|
|
|
| |
Welcome
Time Now: Thu Mar 11, 2010 6:45 am
All times are GMT
|
|
|
|
|
|
|
|
|
|
| |
SEO 1 Forums
>
Mod Rewrite >
phpBB Mod Rewrite
Andrew
Senior Member

Joined: 21 Feb 2005
Good Posts: 994
Location: apache/domlogs |
| phpBB Mod Rewrite |
|
|
For reference, I'm posting the phpBB Mod Rewrite Hack.
Obviously, you've got to use the Apache operating system to take advantage of Mod Rewrite, but this hack is fairly easy:
code:
##############################################################
## MOD Title: mod_rewrite
## MOD Author: wGEric < eric@egcnetwork.com > (Eric Faerber) http://eric.best-1.biz
## MOD Description: Use mod_rewrite on your board. It converts your dynamic links to something
## more Search Engine Friendly
## MOD Version: 1.0.0
##
## Installation Level: Easy/
## Installation Time: 10 Minutes
## Files To Edit: includes/page_header.php
## includes/page_footer.php
## .htaccess (may need to)
## Included Files: .htaccess (may need to use)
##############################################################
## For Security Purposes, Please Check: http://www.phpbb.com/mods/ for the
## latest version of this MOD. Downloading this MOD from other sites could cause malicious code
## to enter into your phpBB Forum. As such, phpBB will not offer support for MOD's not offered
## in our MOD-Database, located at: http://www.phpbb.com/mods/
##############################################################
## Author Notes:
## This MOD requires that mod_rewrite is enabled on your server and
## supports .htaccess.
##
## If your server doesn't support .htaccess you will need to add the
## rewrite rules to your server configuration. I will not help you
## do this. You will be on your own.
##
## If you already have a .htaccess file in the main directory of your,
## you will need to add the contents of the .htaccess file that is included
## to your exsisting file.
##
## If you don't have a .htaccess file in the main directory of your site
## you will need to copy the one that is included with this MOD.
##
##############################################################
## MOD History:
##
## 2004-01-12 - Version 1.0.0
## - First Release
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##############################################################
#
#-----[ COPY ]------------------------------------------
#
# Only do if you don't already have a .htaccess file in the main directory
# of your site. See Author Notes for more information
#
copy .htaccess to .htaccess
#
#-----[ OPEN ]------------------------------------------
#
includes/page_header.php
#
#-----[ FIND ]------------------------------------------
#
# Note: this line has been shortened. The full line is
# $template->set_filenames(array(
# 'overall_header' => ( empty($gen_simple_header) ) ? 'overall_header.tpl' : 'simple_header.tpl')
# );
#
$template->set_filenames(array(
'overall_header' =>
);
#
#-----[ AFTER, ADD ]------------------------------------------
#
ob_start();
function replace_mod_rewrite($s)
{
$urlin = array(
"'(?<!/)viewforum.php\?f=([0-9]*)&topicdays=([0-9]*)&start=([0-9]*)'",
"'(?<!/)viewforum.php\?f=([0-9]*)&mark=topics'",
"'(?<!/)viewforum.php\?f=([0-9]*)'",
"'(?<!/)viewtopic.php\?t=([0-9]*)&view=previous'",
"'(?<!/)viewtopic.php\?t=([0-9]*)&view=next'",
"'(?<!/)viewtopic.php\?t=([0-9]*)&view=newest'",
"'(?<!/)viewtopic.php\?t=([0-9]*)&postdays=([0-9]*)&postorder=([a-zA-Z]*)&start=([0-9]*)'", "'(?<!/)viewtopic.php\?t=([0-9]*)&start=([0-9]*)&postdays=([0-9]*)&postorder=([a-zA-Z]*)&highlight=([a-zA-Z0-9]*)'",
"'(?<!/)viewtopic.php\?t=([0-9]*)&start=([0-9]*)'",
"'(?<!/)viewtopic.php\?t=([0-9]*)'",
"'(?<!/)viewtopic.php\?p=([0-9]*)'");
$urlout = array(
"viewforum\\1-\\2-\\3.php",
"mforum\\1.php",
"forum\\1.php",
"ptopic\\1.php",
"ntopic\\1.php",
"newtopic\\1.php",
"ftopic\\1-\\2-\\3-\\4.php",
"ftopic\\1-\\2-\\3-\\4-\\5.php",
"ftopic\\1-\\2.php",
"ftopic\\1.php",
"sutra\\1.php");
$s = preg_replace($urlin, $urlout, $s);
return $s;
}
#
#-----[ OPEN ]------------------------------------------
#
includes/page_tail.php
#
#-----[ FIND ]------------------------------------------
#
$db->sql_close();
#
#-----[ AFTER, ADD ]------------------------------------------
#
$contents = ob_get_contents();
ob_end_clean();
echo replace_mod_rewrite($contents);
global $dbg_starttime;
#
#-----[ FIND ]------------------------------------------
#
$gzip_contents = ob_get_contents();
ob_end_clean();
#
#-----[ AFTER, ADD ]------------------------------------------
#
echo replace_for_mod_rewrite($contents);
global $dbg_starttime;
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#
# EoM
_____________________________________________
.htacess file
Create this file in your forum's root directory, or add it's contents to an existning .htaccess file.
code:
RewriteEngine On
RewriteRule ^forums.* /index.php
RewriteRule ^viewforum([0-9]*)-([0-9]*)-([0-9]*).* /viewforum.php?f=$1&topicdays=$2&start=$3
RewriteRule ^mforum([0-9]*).* /viewforum.php?f=$1&mark=topic
RewriteRule ^forum([0-9]*).* /viewforum.php?f=$1
RewriteRule ^ptopic([0-9]*).* /viewtopic.php?t=$1&view=previous
RewriteRule ^ntopic([0-9]*).* /viewtopic.php?t=$1&view=next
RewriteRule ^newtopic([0-9]*).* /viewtopic.php?t=$1&view=newest
RewriteRule ^ftopic([0-9]*)-([0-9]*)-([a-zA-Z]*)-([0-9]*).* /viewtopic.php?t=$1&postdays=$2&postorder=$3&start=$4
RewriteRule ^ftopic([0-9]*)-([0-9]*)-([0-9]*)-([a-zA-Z]*)-([a-zA-Z]*).* /viewtopic.php?t=$1&start=$2&postdays=$3&postorder=$4&highlight=$5
RewriteRule ^ftopic([0-9]*)-([0-9]*).* /viewtopic.php?t=$1&start=$2
RewriteRule ^ftopic([0-9]*).* /viewtopic.php?t=$1
RewriteRule ^sutra([0-9]*).* /viewtopic.php?p=$1
Last edited by Andrew on Fri Feb 03, 2006 4:21 am; edited 2 times in total |
Tue Jan 31, 2006 10:05 pm |
|
|
Andrew
Senior Member

Joined: 21 Feb 2005
Good Posts: 994
Location: apache/domlogs |
Thanks hoptoo.
That reminds me to mention that removing SIDs for the Search Bots is even more important that the mod_rewrite, so make sure to get that if you are going to the trouble to rewrite your forum. |
Wed Feb 01, 2006 3:23 pm |
|
|
xboxundone
Senior Member

Joined: 04 Mar 2005
Good Posts: 243
|
yes mod rewrite is GREAT 
|
Thu Feb 02, 2006 8:45 pm |
|
|
ibold
Preferred Member
Joined: 09 Dec 2005
Good Posts: 169
Location: Reading, PA, USA |
quote: Originally posted by xboxundone yes mod rewrite is GREAT 
Tru that..thanks for the mod, I'm about to give it a go on my latest forum 
iPowerWeb Review | The Meaning of Dreams |
Thu Feb 02, 2006 9:20 pm |
|
|
justicewhite
Senior Member
Joined: 12 Aug 2005
Good Posts: 800
|
Is there any performance impact on the phpBB forum apart from the usual mod rewrite?
Estate Agents Reading || Letting Agents Reading |
Mon Feb 06, 2006 9:28 pm |
|
|
xboxundone
Senior Member

Joined: 04 Mar 2005
Good Posts: 243
|
quote: Originally posted by justicewhite Is there any performance impact on the phpBB forum apart from the usual mod rewrite?
nope runs just as smooth.
|
Mon Feb 06, 2006 10:05 pm |
|
|
cheapdomainseller
Senior Member
Joined: 01 Mar 2006
Good Posts: 334
|
Just about to give this one a go now, i'll let you guys/girls know how it goes.
What version of PHP is the above script for?
As I had trouble finding the first bit of data. in the first file that needs to be open. |
Wed Mar 01, 2006 11:59 am |
|
|
michael
Contributing Member
Joined: 07 Mar 2006
Good Posts: 27
|
quote: Originally posted by cheapdomainseller Hi Andew,
no luck with this one, is there an update for this script or another mod about?
-----UPDATE
Another mod which i was successful installing:
http://www.phpbb4you.com/phpbb-static-url-hack.html
I couldn't get the other one working either, but got this one working, one problem with it is the session stuff adds to the end of the HTML part. |
Tue Mar 07, 2006 10:19 am |
|
|
pda
Full Member
Joined: 31 Mar 2006
Good Posts: 61
|
I did some phpbb seo stuff about 2 years ago on my forum but cant remember now what it was,i think i removed session ID,s for the bots.
My pages look like this:
forum/viewtopic.php?t=6569
Would i be better off using the mod above ? |
Sat Apr 01, 2006 12:38 am |
|
|
cheapdomainseller
Senior Member
Joined: 01 Mar 2006
Good Posts: 334
|
ltcobretti: Why are SID's bad ?
I think the main reason they are bad is because google see's each SID as a new page, that means each time google spiders your page they think you have created a new page.
BTW people:
I've used the following mod-rewrte recently.
http://www.phpbb.com/phpBB/viewtopic.php?t=150631&highlight=rewrite
Cheap domain registrations - Very cheap domain name prices. |
Fri Sep 15, 2006 7:24 am |
|
|
Andrew
Senior Member

Joined: 21 Feb 2005
Good Posts: 994
Location: apache/domlogs |
Google does index pages with SIDs, I think, but I've seen Googlebot be much happier with my forums after removing the SIDs. Much more spidering and indexing.
Here's a hack which includes the mod_rewrite and SIDs all in one, that might be of interest....
http://www.phpbbhacks.com/download/2040 |
Fri Sep 15, 2006 6:45 pm |
|
|
Goto page 1, 2 Next
|
|
|
|
|
|
|