Seite 1 von 1

Wer benutzt den Mod: Static-looking phpBB pages

Verfasst: 24.12.2003 20:50
von mr. gamesbay
Benutzt hier einer diesen Mod ?

## MOD Title: Static-looking phpBB pages
## MOD Author: Acid Paul

Funzt eigentlich Top, habe aber ein kleines Prob.
Wenn ich auf [ externes Bild ]
im Forum klicke, werde ich immer auf die erste Seite des Themas (nie zum neusten Beitrag) geschmissen, nie auf die 2te oder 3te.

Verfasst: 25.12.2003 18:31
von Acid
hmm.. und was macht dieser MOD?
Speicher mal die viewforum.php als *.txt ab und poste einen Link.

Verfasst: 25.12.2003 23:16
von mr. gamesbay
Acid hat geschrieben:hmm.. und was macht dieser MOD?
Speicher mal die viewforum.php als *.txt ab und poste einen Link.

Code: Alles auswählen

##############################################################
## MOD Title: Static-looking phpBB pages
## MOD Author: Acid Paul
##############################################################
## MOD Description:
## I have modified the Googlifier mod for PHPNuke with PHPBB2 port
## found at www.orientalgate.org to work with standalone PHPBB2. This
## mod allows you to turn dynamic forum urls into static ones and
## therefore get better indexed and ranked by Google & co., as well as
## picked by search engines, that don't like dynamic URLs (e.g.
## AllTheWeb).
##                         
## The effect is like this:
##
## > viewtopic.php?t=157 => ftopic28.html
##
## (affects all topics, posts, forum folders and pagination; member
## profiles, search, lorgin and usergroups URL stay unchanged; the main
## page remains index.php)
##
## Requirements: you need mod_rewrite enabled as well as ability to
## use .htaccess or modify apache config files.
##
## Implementation:
##############################################################

#
#---[ Open ]--------------------------
#
/includes/page_header.php

#
#---[ Find ]------------------------
#
//
// Generate logged in/logged out status
//

#
#---[ Before, Add ]---------------------------
#
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'",
"'(?<!/)viewforum.php\?f=([0-9]*)'",
"'(?<!/)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]*)&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]*)'",
"'(?<!/)viewtopic.php\?p=([0-9]*)'",
);
$urlout = array(
"viewforum\\1-\\2-\\3.html",
"forum\\1.html",
"forum\\1.html",
"ptopic\\1.html",
"ntopic\\1.html",
"ftopic\\1-\\2-\\3-\\4.html",
"ftopic\\1.html",
"ftopic\\1-\\2.html",
"ftopic\\1.html",
"sutra\\1.html",
"sutra\\1.html",
);
$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_for_mod_rewrite($contents);
global $dbg_starttime;

#
#---[ Find ]-------------------------
#
ob_end_clean();


#
#---[ After, Add ]---------------------------
#
echo replace_for_mod_rewrite($contents);
global $dbg_starttime;


#
#---[ Open ]--------------------------
# Or create. In forum root.
.htaccess

#
#---[ Add ]---------------------------
#
RewriteEngine On
RewriteRule ^forum.* index.php
RewriteRule ^forum([0-9]*).* viewforum.php?f=$1&mark=topic
RewriteRule ^viewforum([0-9]*)-([0-9]*)-([0-9]*).* viewforum.php?f=$1&topicdays=$2&start=$3
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 ^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]*).* viewtopic.php?t=$1&start=$2
RewriteRule ^ftopic([0-9]*).* viewtopic.php?t=$1
RewriteRule ^ftopic([0-9]*).html viewtopic.php?t=$1&start=$2&postdays=$3&postorder=$4&highlight=$5
RewriteRule ^sutra([0-9]*).* viewtopic.php?p=$1

#
#---[ Or ]----------------------------
# Note: sometimes this .htaccess code won't work properly if the forum is
# on a subdomain, you may need to try this variation:
RewriteEngine On
RewriteRule ^forums.* /index.php
RewriteRule ^forum([0-9]*).* /viewforum.php?f=$1&mark=topic
RewriteRule ^viewforum([0-9]*)-([0-9]*)-([0-9]*).* /viewforum.php?f=$1&topicdays=$2&start=$3
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 ^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]*).* /viewtopic.php?t=$1&start=$2
RewriteRule ^ftopic([0-9]*).* /viewtopic.php?t=$1
RewriteRule ^ftopic([0-9]*).html /viewtopic.php?t=$1&start=$2&postdays=$3&postorder=$4&highlight=$5
RewriteRule ^sutra([0-9]*).* /viewtopic.php?p=$1


#
#---[ Open ]--------------------------
# At the *site* root
robots.txt


#
#---[ Add ]---------------------------
#
Disallow: /your-forum-folder/sutra*.html$
Disallow: /your-forum-folder/ptopic*.html$
Disallow: /your-forum-folder/ntopic*.html$
Disallow: /your-forum-folder/ftopic*asc*.html$


# (This is required to avoid feeding duplicate content to Google)
#
# Step 5. Apply Google Mod #1 described at this page.
#
# Congrats! Now you now have traffic-generating mogul.
# _________________
# Acidics.com - dissolving online scams and hoaxes
# Go pour some acid on fraudsters at Forum.acidics.com
#
#
##############################################################
## Seems like I'm overcreative now  - actually all I'm doing now is
## nursing the forum for search engines. Here's one more mod which
## addresses the pagination issue:
##
## Problem: when the topic has 15+ posts it is devided into several
## pages (whether pages are limited to 15 posts per page depends on
## how you set your board properties). The bad thing is that from the list
## of topics URLs to multiple pages look like
## "viewtopic.php?t=47&start=105" but when you open these pages URLs
## grow huge to
## "viewtopic.php?t=47&postdays=0&postorder=asc&start=105" though
## they lead to the same pages. Search engines will think these are
## different pages holding duplicate content and may penalize your
## forum site. There're two solutions: just use robots.txt to forbid
## spidering these long URLs or apply this mod:
##
## Mod effect: solves the pagination issue described above; as you have
## universal links across the board they contribute to inbound link
## structure, actively funnel PageRank between pages and allow SE
## spiders to index your forum deeper. This enhancement can be freely
## used in conjunction with my previous mod_rewrite mod (found at
## page 31 in this thread). -> [ quixilver: that's the code above ]
##
## Requirements: none, just a text editor
##
## Implementation:
##############################################################

#
#---[ Open ]--------------------------
#
viewtopic.php

#
#---[ Find ]---------------------------
# One big line.
$pagination = ( $highlight_active ) ? generate_pagination("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order&highlight=$highlight", $total_replies, $board_config['posts_per_page'], $start) : generate_pagination("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order", $total_replies, $board_config['posts_per_page'], $start);

#
#---[ Replace with ]-------------------
#
if ($post_days==0 && $post_order==asc)
{
$pagination = ( $highlight_active ) ? generate_pagination("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&highlight=$highlight", $total_replies, $board_config['posts_per_page'], $start) : generate_pagination("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id", $total_replies, $board_config['posts_per_page'], $start);
}
else
{
$pagination = ( $highlight_active ) ? generate_pagination("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order&highlight=$highlight", $total_replies, $board_config['posts_per_page'], $start) : generate_pagination("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&postdays=$post_days&postorder=$post_order", $total_replies, $board_config['posts_per_page'], $start);
}

#
#---[ End ]---------------------------
#

##############################################################
##
## Enjoy! Comments are welcome
##
## P.S. some more rules should be added to robots.txt to prevent
## spidering of "viewtopic.php?t=47&start=0"-type URLs (another
## duplicate-content problem). I'll play with robots.txt validators and
## come up with a neat code later.
##############################################################
Bitte :)