| :: |
| Author |
Message |
Peter77 phpBB SEO Team


Joined: 10 May 2006 Posts: 512 Location: Michigan
|
Posted: Mon Nov 06, 2006 6:41 am Post subject: 301 redirect mxbb Portal's index.php page |
|
|
Hello dcz, was wondering if you could show us how to redirect our index.php using 301 like we did on this thread for phpbb.
thanks! |
|
|
| Back to top |
|
 |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 13354
|
Posted: Mon Nov 06, 2006 9:35 am Post subject: Re: 301 redirect mxbb Portal's index.php page |
|
|
Sure
Open :
index.php
Find :
| Code: | $page_row = get_info(PAGE_TABLE, "page_id", $page_id);
$page_title = $page_row['page_name']; |
After add :
| Code: | // www.phpBB-SEO.com SEO TOOLKIT BEGIN
$uri = $_SERVER['REQUEST_URI'];
if ( empty($_GET) && empty($_POST) && strpos($uri, "index.$phpEx") ) {
seo_redirect(PORTAL_URL);
}
if ( !isset($page_row['page_name']) ) {
seo_redirect(PORTAL_URL);
//message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
}
// www.phpBB-SEO.com SEO TOOLKIT END |
Note that I implemented an additional redirection for when the page does not exist, will be http 301 redirected to portal's root as well
This is again a version to work with the zero duplicate
++ |
_________________ Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________
Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche
Last edited by dcz on Mon Nov 06, 2006 9:35 pm; edited 2 times in total |
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 13354
|
|
| Back to top |
|
 |
Peter77 phpBB SEO Team


Joined: 10 May 2006 Posts: 512 Location: Michigan
|
Posted: Wed Nov 08, 2006 8:10 am Post subject: Re: 301 redirect mxbb Portal's index.php page |
|
|
I wanted to test this at least a day before giving feedback, and it works like a charm.
| dcz wrote: |
Note that I implemented an additional redirection for when the page does not exist, will be http 301 redirected to portal's root as well
This is again a version to work with the zero duplicate
++ |
Here are you talking about pages of mxbb portal? ( index.php?page=12 ) because I remember we took care of that once... so here is what that part of the index.php looks like;
| Code: | //
// Load default header
//
$page_id = $mx_request_vars->request('page', MX_TYPE_INT, 1);
$page_row = get_info(PAGE_TABLE, "page_id", $page_id);
$page_title .= $page_row['page_name'];
// www.phpBB-SEO.com SEO TOOLKIT BEGIN
$uri = strtolower($_SERVER['REQUEST_URI']);
if ( empty($_GET) && empty($_POST) && strpos($uri, "index.$phpEx") ) {
seo_redirect(PORTAL_URL);
}
if ( !isset($page_row['page_name']) ) {
seo_redirect(PORTAL_URL);
//message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
}
// www.phpBB-SEO.com SEO TOOLKIT BEGIN
if ( !isset($page_row['page_name']) )
{
header("Status: 301 Moved Permanently", false, 301);
header("Location:" . PORTAL_URL . "index.$phpEx");
exit();
}
// www.phpBB-SEO.com SEO TOOLKIT END
include($mx_root_path . 'includes/page_header.'.$phpEx); |
Is this right? |
|
|
| Back to top |
|
 |
dcz Administrateur - Site Admin

Joined: 28 Apr 2006 Posts: 13354
|
Posted: Wed Nov 08, 2006 9:39 am Post subject: Re: 301 redirect mxbb Portal's index.php page |
|
|
Well yes, but the old one is now left unused, I merged the two in one, so you just need :
| Code: | //
// Load default header
//
$page_id = $mx_request_vars->request('page', MX_TYPE_INT, 1);
$page_row = get_info(PAGE_TABLE, "page_id", $page_id);
$page_title .= $page_row['page_name'];
// www.phpBB-SEO.com SEO TOOLKIT BEGIN
$uri = strtolower($_SERVER['REQUEST_URI']);
if ( empty($_GET) && empty($_POST) && strpos($uri, "index.$phpEx") ) {
seo_redirect(PORTAL_URL);
}
if ( !isset($page_row['page_name']) ) {
seo_redirect(PORTAL_URL);
//message_die(GENERAL_MESSAGE, 'Topic_post_not_exist');
}
// www.phpBB-SEO.com SEO TOOLKIT BEGIN
include($mx_root_path . 'includes/page_header.'.$phpEx); |
 |
_________________ Useful links :
SEO Forum || SEO Directory || SEO phpBB || SEO phpBB3 || Search
____________________
Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Référencement phpBB3 || Recherche |
|
| Back to top |
|
 |
Peter77 phpBB SEO Team


Joined: 10 May 2006 Posts: 512 Location: Michigan
|
Posted: Thu Nov 09, 2006 4:47 am Post subject: Re: 301 redirect mxbb Portal's index.php page |
|
|
Thanks, dcz!  |
|
|
| Back to top |
|
 |
Peter77 phpBB SEO Team


Joined: 10 May 2006 Posts: 512 Location: Michigan
|
Posted: Thu Aug 30, 2007 9:08 am Post subject: Re: 301 redirect mxbb Portal's index.php page |
|
|
I've been wondering if you have upgraded your portal to the "gold" version of 2.8 yet? The index.php is a lot different . If it saves you time, Is there a way to add a rewrite rule in .htcacess instead of editing mxbb ?
:edit: solved by using
| Code: | RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/
RewriteRule ^index\.php$ http://www.site.com/ [R=301,L] |
|
|
|
| Back to top |
|
 |
|
|