This you can change in phpbb_seo_class.php :
- Code: Select all
$this->seo_ext = array('cat' => '.html',
'forum' => '.html',
'topic' => '.html',
'user' => '.html',
'gz_ext' => '',
);
If you set to :
- Code: Select all
$this->seo_ext = array('cat' => '.html',
'forum' => '/',
'topic' => '.html',
'user' => '.html',
'gz_ext' => '',
);
and update the .htaccess accordingly for forums :
- Code: Select all
# PAGINATED FORUM
RewriteRule ^phpbb/.*-f([0-9]+)-([0-9]+)\.html$ /phpbb/viewforum.php?f=$1&start=$2 [QSA,L]
# FORUM
RewriteRule ^phpbb/.*-f([0-9]+)\.html$ /phpbb/viewforum.php?f=$1 [QSA,L]
to :
- Code: Select all
# PAGINATED FORUM
RewriteRule ^phpbb/.*-f([0-9]+)-([0-9]+)/$ /phpbb/viewforum.php?f=$1&start=$2 [QSA,L]
# FORUM
RewriteRule ^phpbb/.*-f([0-9]+)/$ /phpbb/viewforum.php?f=$1 [QSA,L]
Should work on all forum urls at once.
And the zero duplicate will follow the change by itself.
Then, after the phpBB SEO rewriterules, add :
- Code: Select all
#we keep them to kill them ;-)
RewriteRule ^forums.* /new_folder/index.php [L,NC]
RewriteRule ^post-([0-9]*).html&highlight=([a-zA-Z0-9]*) /new_folder/viewtopic.php?p=$1&highlight=$2 [L,NC]
RewriteRule ^post-([0-9]*).* /viewtopic.php?p=$1 [L,NC]
RewriteRule ^view-poll([0-9]*)-([0-9]*)-([a-zA-Z]*).* /new_folder/viewtopic.php?t=$1&postdays=$2&postorder=$3&vote=viewresult [L,NC]
RewriteRule ^about([0-9]*).html&highlight=([a-zA-Z0-9]*) /new_folder/viewtopic.php?t=$1&highlight=$2 [L,NC]
RewriteRule ^about([0-9]*).html&view=newest /new_folder/viewtopic.php?t=$1&view=newest [L,NC]
RewriteRule ^about([0-9]*)-([0-9]*)-([a-zA-Z]*)-([0-9]*).* /new_folder/viewtopic.php?t=$1&postdays=$2&postorder=$3&start=$4 [L,NC]
RewriteRule ^about([0-9]*)-([0-9]*).* /new_folder/viewtopic.php?t=$1&start=$2 [L,NC]
RewriteRule ^about([0-9]*).* /new_folder/viewtopic.php?t=$1 [L,NC]
RewriteRule ^about([0-9]*).html /new_folder/viewtopic.php?t=$1&start=$2&postdays=$3&postorder=$4&highlight=$5 [L,NC]
RewriteRule ^mark-forum([0-9]*).html* /new_folder/viewforum.php?f=$1&mark=topics [L,NC]
RewriteRule ^updates-topic([0-9]*).html* /new_folder/viewtopic.php?t=$1&watch=topic [L,NC]
RewriteRule ^stop-updates-topic([0-9]*).html* /new_folder/viewtopic.php?t=$1&unwatch=topic [L,NC]
RewriteRule ^forum-([0-9]*).html /new_folder/viewforum.php?f=$1 [L,NC]
RewriteRule ^forum-([0-9]*).* /new_folder/viewforum.php?f=$1 [L,NC]
RewriteRule ^topic-([0-9]*)-([0-9]*)-([0-9]*).* /new_folder/viewforum.php?f=$1&topicdays=$2&start=$3 [L,NC]
RewriteRule ^ptopic([0-9]*).* /new_folder/viewtopic.php?t=$1&view=previous [L,NC]
RewriteRule ^ntopic([0-9]*).* /new_folder/viewtopic.php?t=$1&view=next [L,NC]
Then, create a viewforum.php file and put this in it :
- Code: Select all
<?php
/**
*
* @package phpBB SEO redirection suite
* @version $Id: phpbb_seo_class.php,v 1.0 2006/12/09 13:48:48 dcz Exp $
* @copyright (c) 2006 dcz - www.phpbb-seo.com
* @http://opensource.org/licenses/gpl-license.php GNU General Public License v2
*
*/
define('IN_PHPBB', true);
$phpbb_root_path = './new_folder/';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
//
// Start initial var setup
//
if ( isset($HTTP_GET_VARS[POST_FORUM_URL]) || isset($HTTP_POST_VARS[POST_FORUM_URL]) )
{
$forum_id = ( isset($HTTP_GET_VARS[POST_FORUM_URL]) ) ? intval($HTTP_GET_VARS[POST_FORUM_URL]) : intval($HTTP_POST_VARS[POST_FORUM_URL]);
}
else if ( isset($HTTP_GET_VARS['forum']))
{
$forum_id = intval($HTTP_GET_VARS['forum']);
}
else
{
$forum_id = '';
}
$start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
$start = ($start < 0) ? 0 : $start;
$server_protocol = ($board_config['cookie_secure']) ? 'https://' : 'http://';
$server_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($board_config['server_name']));
$server_port = ($board_config['server_port'] <> 80) ? ':' . trim($board_config['server_port']) : '';
$script_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($board_config['script_path']));
$script_name = ($script_name == '') ? '' : $script_name . '/';
$root_url = $server_protocol . $server_name . $server_port . '/';
$phpbb_url = $root_url . $script_name;
if (!empty($forum_id)) {
if ( !empty($db) ) {
$db->sql_close();
}
$url = "viewforum.$phpEx?" . POST_FORUM_URL . "=$forum_id";
header("HTTP/1.1 301 Moved Permanently", TRUE, 301);
header("Location: " . $phpbb_url . $url);
exit();
} else {
if ( !empty($db) ) {
$db->sql_close();
}
$url = "index.$phpEx";
header("HTTP/1.1 301 Moved Permanently", TRUE, 301);
header("Location: " . $phpbb_url);
exit();
}
?>
and create a viewtopic.php file and put this in it :
- Code: Select all
<?php
/**
*
* @package phpBB SEO redirection suite
* @version $Id: phpbb_seo_class.php,v 1.0 2006/12/09 13:48:48 dcz Exp $
* @copyright (c) 2006 dcz - www.phpbb-seo.com
* @http://opensource.org/licenses/gpl-license.php GNU General Public License v2
*
*/
define('IN_PHPBB', true);
// You need here to set the correct path to your forum !!!
$phpbb_root_path = './new_folder/';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
//
// Start initial var setup
//
$topic_id = $post_id = 0;
$url = '';
if ( isset($HTTP_GET_VARS[POST_TOPIC_URL]) )
{
$topic_id = intval($HTTP_GET_VARS[POST_TOPIC_URL]);
}
else if ( isset($HTTP_GET_VARS['topic']) )
{
$topic_id = intval($HTTP_GET_VARS['topic']);
}
if ( isset($HTTP_GET_VARS[POST_POST_URL]))
{
$post_id = intval($HTTP_GET_VARS[POST_POST_URL]);
}
$start = ( isset($HTTP_GET_VARS['start']) ) ? intval($HTTP_GET_VARS['start']) : 0;
$start = ($start < 0) ? 0 : $start;
if (!$topic_id && !$post_id)
{
message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
}
$server_protocol = ($board_config['cookie_secure']) ? 'https://' : 'http://';
$server_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($board_config['server_name']));
$server_port = ($board_config['server_port'] <> 80) ? ':' . trim($board_config['server_port']) : '';
$script_name = preg_replace('#^\/?(.*?)\/?$#', '\1', trim($board_config['script_path']));
$script_name = ($script_name == '') ? '' : $script_name . '/';
$root_url = $server_protocol . $server_name . $server_port . '/';
$phpbb_url = $root_url . $script_name;
if ($topic_id) {
if ( !empty($db) ) {
$db->sql_close();
}
$url = "viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id";
header("HTTP/1.1 301 Moved Permanently", TRUE, 301);
header("Location: " . $phpbb_url . $url);
exit();
} elseif ($post_id) {
if ( !empty($db) ) {
$db->sql_close();
}
$url = "viewtopic.$phpEx?" . POST_POST_URL . "=$post_id#$post_id";
header("HTTP/1.1 301 Moved Permanently", TRUE, 301);
header("Location: " . $phpbb_url . $url);
exit();
} else {
if ( !empty($db) ) {
$db->sql_close();
}
$url = "index.$phpEx";
header("HTTP/1.1 301 Moved Permanently", TRUE, 301);
header("Location: " . $phpbb_url);
exit();
}
?>
Note that you'll have to replace
new_folder by the rel folder name where phpBB is installed in both the created viewforum.php and viewtopic.php and the .htaccess.
The viewtopic.php and viewtopic.php are meant to be uploaded at the root level, in order to redirect old vanilla url : viewtopic.php?t=xx to new_folder/viewtopic.php?t=xx, allowing the zero duplicate to do its job for these too.
You'll have to check headers for these the same way you did for the zero duplicate, since here it's php redirection, we need to make sure.
++