Manish
Administrator

Joined: 26 Jul 2006
Posts: 94
Location: India

|
SEO for phpBB
code:
1. Remove sessions
#
#-----[ OPEN ]------------------------------------------
#
includes/sessions.php
#
#-----[ FIND ]------------------------------------------
#
$SID = 'sid=' . $session_id;
#
#-----[ REPLACE WITH ]------------------------------------------
#
if ( $userdata['session_user_id'] != ANONYMOUS ){
$SID = 'sid=' . $session_id;
} else {
$SID = '';
}
.htaccess
#
#-----[ ADD ]------------------------------------------
#
RewriteEngine On
RewriteRule ^forums.* index.php [L,NC]
RewriteRule ^post-([0-9]*).html&highlight=([a-zA-Z0-9]*) post-.html$1&highlight=$2 [L,NC]
RewriteRule ^post-([0-9]*).* post-.html$1 [L,NC]
RewriteRule ^view-poll([0-9]*)-([0-9]*)-([a-zA-Z]*).* viewtopic.php?t=$1&postdays=$2&postorder=$3&vote=viewresult [L,NC]
RewriteRule ^about([0-9]*).html&highlight=([a-zA-Z0-9]*) viewtopic.php?t=$1&highlight=$2 [L,NC]
RewriteRule ^about([0-9]*).html&view=newest viewtopic.php?t=$1&view=newest [L,NC]
RewriteRule ^about([0-9]*)-([0-9]*)-([a-zA-Z]*)-([0-9]*).* viewtopic.php?t=$1&postdays=$2&postorder=$3&start=$4 [L,NC]
RewriteRule ^about([0-9]*)-([0-9]*).* viewtopic.php?t=$1&start=$2 [L,NC]
RewriteRule ^about([0-9]*).html viewtopic.php?t=$1&start=$2&postdays=$3&postorder=$4&highlight=$5 [L,NC]
RewriteRule ^topic-([0-9]*)-([0-9]*)-([0-9]*).* viewforum.php?f=$1&topicdays=$2&start=$3 [L,NC]
RewriteRule ^ptopic([0-9]*).* viewtopic.php?t=$1&view=previous [L,NC]
RewriteRule ^ntopic([0-9]*).* viewtopic.php?t=$1&view=next [L,NC]
#my mod
RewriteRule ^forum([0-9]*).html viewforum.php?f=$1 [L,NC]
RewriteRule ^topic([0-9]*).* viewtopic.php?t=$1 [L,NC]
RewriteRule ^topic([0-9]*).html viewtopic.php?t=$1&start=$2&postdays=$3&postorder=$4&highlight=$5 [L,NC]
RewriteRule ^profile([0-9]*).html profile.php?mode=viewprofile&u=$1 [L]
RewriteRule ^search-author-([a-zA-Z0-9_-]*).html search.php?&search_author=$1 [L]
#This is in case username on your phpBB come like FirstName+LastName
RewriteRule ^search-author-([a-zA-Z0-9+-]*).html search.php?&search_author=$1 [L]
#
#-----[ OPEN ]------------------------------------------
#
3. index.php
Find
'U_VIEWFORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id"))
Replace with
'U_VIEWFORUM' => append_sid("forum$forum_id.html"))
#
#-----[ OPEN ]------------------------------------------
#
4. viewforum.php
Find
'U_VIEW_FORUM' => append_sid("viewforum.$phpEx?" . POST_FORUM_URL ."=$forum_id"),
Replace with
'U_VIEW_FORUM' => append_sid("forum$forum_id.html"),
Find
$view_topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id");
Replace with
$view_topic_url = append_sid("topic$topic_id.html");
#
#-----[ OPEN ]------------------------------------------
#
5. viewtopic.php
Find
$view_forum_url = append_sid("viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id");
Replace with
$view_forum_url = append_sid("forum$forum_id.html");
Find
'U_VIEW_TOPIC' => append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&start=$start&postdays=$post_days&postorder=$post_order&highlight=$highlight"),
Replace
'U_VIEW_TOPIC' => append_sid("topic$topic_id.html"),
#
#-----[ OPEN ]------------------------------------------
#
6. memberlist.php
Find
'U_VIEWPROFILE' => append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=$user_id"))
Replace
'U_VIEWPROFILE' => append_sid("profile$user_id.html"))
#
#-----[ OPEN ]------------------------------------------
#
7. usercp_viewprofile.php
Find
'U_SEARCH_USER' => append_sid("search.$phpEx?search_author=" . $u_search_author),
Replace
'U_SEARCH_USER' => append_sid("search-author-" . $u_search_author . '.html'),
Find
$page_title = $lang['Viewing_profile'];
Replace
$page_title = $profiledata['username'] ;
#
#-----[ OPEN ]------------------------------------------
#
8. search.php
Find
$poster = ( $searchset[$i]['user_id'] != ANONYMOUS ) ? '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $searchset[$i]['user_id']) . '">' : '';
Replace
$poster = ( $searchset[$i]['user_id'] != ANONYMOUS ) ? '<a href="' . append_sid("profile" . $searchset[$i]['user_id']) . '.html'.'">' : '';
Find
$forum_url = append_sid("viewforum.$phpEx?" . POST_FORUM_URL . '=' . $searchset[$i]['forum_id']);
Replace with
$forum_url = append_sid("forum" . $searchset[$i]['forum_id'] . '.html');
Find
$topic_url = append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . '=' . $searchset[$i]['topic_id'] . "&highlight=$highlight_active");
Replace with
$topic_url = append_sid("topic" . $searchset[$i]['topic_id'] . '.html');
#
#-----[ OPEN ]------------------------------------------
#
9. page_header.php
Find
$user_online_link = '<a href="' . append_sid("profile.$phpEx?mode=viewprofile&" . POST_USERS_URL . "=" . $row['user_id']) . '"' . $style_color .'>' . $row['username'] . '</a>';
Replace with
$user_online_link = '<a href="' . append_sid("profile" . $row['user_id']) . '.html' . '"' . $style_color .'>' . $row['username'] . '</a>';
Pagination
#
#-----[ OPEN ]------------------------------------------
#
includes/page_header.php
#
#-----[ FIND ]------------------------------------------
#
//
// Generate logged in/logged out status
//
#
#-----[ AFTER, ADD ]------------------------------------------
#
if ( !$userdata['session_logged_in'] )
{
ob_start();
function replace_for_mod_rewrite(&$s)
{
$urlin =
array(
"'(?<!/)viewforum.php\?f=([0-9]*)&topicdays=([0-9]*)&start=([0-9]*)'",
"'(?<!/)viewforum.php\?f=([0-9]*)&mark=topics'",
"'(?<!/)viewtopic.php\?t=([0-9]*)&watch=topic*'",
"'(?<!/)viewtopic.php\?t=([0-9]*)&unwatch=topic*'",
"'(?<!/)viewtopic.php\?t=([0-9]*)&highlight=*'",
"'(?<!/)viewtopic.php\?t=([0-9]*)&view=previous'",
"'(?<!/)viewtopic.php\?t=([0-9]*)&view=next'",
"'(?<!/)viewtopic.php\?t=([0-9]*)&postdays=([0-9]*)&postorder=([a-zA-Z]*)&vote=viewresult'",
"'(?<!/)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&p=([0-9]*)'",
"'(?<!/)viewtopic.php\?p=([0-9]*)'",
);
$urlout = array(
"topic-\\1-\\2-\\3.html",
"mark-forum\\1.html",
"updates-topic\\1.html",
"stop-updates-topic\\1.html",
"about\\1.html&highlight=\\2",
"ptopic\\1.html",
"ntopic\\1.html",
"view-poll\\1-\\2-\\3.html",
"about\\1-\\2-\\3-\\4.html",
"about\\1.html",
"about\\1-\\2.html",
"post-\\1.html",
"post-\\1.html",
);
$s = preg_replace($urlin, $urlout, $s);
return $s;
}
}
#
#-----[ OPEN ]------------------------------------------
#
includes/page_tail.php
#
#-----[ FIND ]------------------------------------------
#
$db->sql_close();
#
#-----[ AFTER, ADD ]------------------------------------------
#
if ( !$userdata['session_logged_in'] )
{
$contents = ob_get_contents();
ob_end_clean();
echo replace_for_mod_rewrite($contents);
global $dbg_starttime;
}
#
#-----[ OPEN ]------------------------------------------
#
#
#-----[ OPEN ]------------------------------------------
#
robots.txt
Disallow: forums/post-*.html$
Disallow: forums/updates-topic.html*$
Disallow: forums/stop-updates-topic.html*$
Disallow: forums/ptopic*.html$
Disallow: forums/ntopic*.html$
#
#-----[ OPEN ]------------------------------------------
#
includes/functions.php
#
#-----[ FIND ]------------------------------------------
#
if (!empty($db))
{
$db->sql_close();
}
#
#-----[ AFTER, ADD ]------------------------------------------
#
if ( !$userdata['session_logged_in'] )
{
if (stristr($url, 'http://')) {
header('Location: ' . $url);
exit;
}
}
#
#-----[ SAVE/CLOSE ALL FILES ]------------------------------------------
#-----[-----------NJOY-----------------------------------------------------
Source : http://www.doriat.com/mod_rewrite5.html _________________
SEO Tips
|