[Archive] phpBB SEO Simple mod Rewrite V 0.0.2

phpBB2 SEO Simple mod Rewrite support forum.
This mods performs a fully static URL rewriting for phpBB.
Simple and efficient.

Moderator: Moderators

Postby dcz » Thu Oct 26, 2006 5:08 pm

I get it now sorry :lol:

So the french part I did not noticed in the install is just telling you to take a look at the www prefix duplicate and to put your .htaccess in root.

++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21219
Joined: Fri Apr 28, 2006 9:03 pm

Advertisement

Postby HB. » Thu Oct 26, 2006 5:11 pm

ok thanks, I didn't want to continue with the install not knowing the french part.
HB.
PR0
PR0
 
Posts: 62
Joined: Thu Oct 26, 2006 1:26 am

Postby HB. » Thu Oct 26, 2006 5:13 pm

sorry forgot to ask

Code: Select all
# PAGINATED FORUM
RewriteRule ^forum([0-9]+)-([0-9]+)-([0-9]+)\.html$ /index.php?f=$1&ppage=$2&start=$3 [QSA,L]
# PAGINATED FORUM
RewriteRule ^forum([0-9]+)-([0-9]+)\.html$ /index.php?f=$1&ppage=$2 [QSA,L]
# FORUM
RewriteRule ^forum([0-9]+)\.html$ /index.php?f=$1 [QSA,L]
# PAGINATED TOPIC
RewriteRule ^topic([0-9]+)-([0-9]+)\.html$ /viewtopic.php?t=$1&start=$2 [QSA,L]
# TOPIC
RewriteRule ^topic([0-9]+)\.html$ /viewtopic.php?t=$1 [QSA,L]
# POST
RewriteRule ^post([0-9]+)\.html$ /viewtopic.php?p=$1 [QSA,L]
#PROFILES
RewriteRule ^membre([0-9]+)\.html$ /profile.php?mode=viewprofile&u=$1 [QSA,L]
# END PHPBB PAGES


when adding these should I leave out the "#" sign?
HB.
PR0
PR0
 
Posts: 62
Joined: Thu Oct 26, 2006 1:26 am

Postby euroman » Thu Oct 26, 2006 6:08 pm

HB. wrote:sorry forgot to ask

Code: Select all
# PAGINATED FORUM
RewriteRule ^forum([0-9]+)-([0-9]+)-([0-9]+)\.html$ /index.php?f=$1&ppage=$2&start=$3 [QSA,L]
# PAGINATED FORUM
RewriteRule ^forum([0-9]+)-([0-9]+)\.html$ /index.php?f=$1&ppage=$2 [QSA,L]
# FORUM
RewriteRule ^forum([0-9]+)\.html$ /index.php?f=$1 [QSA,L]
# PAGINATED TOPIC
RewriteRule ^topic([0-9]+)-([0-9]+)\.html$ /viewtopic.php?t=$1&start=$2 [QSA,L]
# TOPIC
RewriteRule ^topic([0-9]+)\.html$ /viewtopic.php?t=$1 [QSA,L]
# POST
RewriteRule ^post([0-9]+)\.html$ /viewtopic.php?p=$1 [QSA,L]
#PROFILES
RewriteRule ^membre([0-9]+)\.html$ /profile.php?mode=viewprofile&u=$1 [QSA,L]
# END PHPBB PAGES


when adding these should I leave out the "#" sign?


I left them in and it works fine.
euroman
PR0
PR0
 
Posts: 81
Joined: Sat Oct 21, 2006 10:18 pm

Postby HB. » Thu Oct 26, 2006 6:20 pm

Thanks,

Ok instead of asking questions bit by bit as I go, I guess I'll compile all my questions within 1 posts

I'm assuming all of this gets added to the .htaccess? I looked at another short url MOD like this one before, and they had similar code in the includes/pageheader.php so I didn't want to get confused.
Code: Select all
#########################################################
# PHPBB SEO REWRITE RULES            #
#########################################################
# AUTHOR : DCZ http://www.phpbb-seo.com/
# STARTED : 01/2006
#####################################################
# FORUMS PAGES
########################
# PAGINATED FORUM
RewriteRule ^phpbb/forum([0-9]+)-([0-9]+)-([0-9]+)\.html$ /phpbb/index.php?f=$1&ppage=$2&start=$3 [QSA,L]
# PAGINATED FORUM
RewriteRule ^phpbb/forum([0-9]+)-([0-9]+)\.html$ /phpbb/index.php?f=$1&ppage=$2 [QSA,L]
# FORUM
RewriteRule ^phpbb/forum([0-9]+)\.html$ /phpbb/index.php?f=$1 [QSA,L]
# PAGINATED TOPIC
RewriteRule ^phpbb/topic([0-9]+)-([0-9]+)\.html$ /phpbb/viewtopic.php?t=$1&start=$2 [QSA,L]
# TOPIC
RewriteRule ^phpbb/topic([0-9]+)\.html$ /phpbb/viewtopic.php?t=$1 [QSA,L]
# POST
RewriteRule ^phpbb/post([0-9]+)\.html$ /phpbb/viewtopic.php?p=$1 [QSA,L]
#PROFILES
RewriteRule ^phpbb/membre([0-9]+)\.html$ /phpbb/profile.php?mode=viewprofile&u=$1 [QSA,L]

#####################################################


There are other french commands I don't know what to do with them

Code: Select all
#
#-----[ OPEN ]------------------------------------------
#

viewtopic.php

#
#-----[ FIND ]------------------------------------------
#

//
// Send vars to template
//

#
#-----[ AFTER, ADD ]------------------------------------------
# Dans cette partie, vous pouvez choisir de ne pas utiliser de highlight, ce qui, d'un point de vue du référencment est
# plus efficace, mais cela retire un peu du confort utilisateur.
# Pour ce faire, retirez simplement la variable $highlight_ok dans le prochain [ REPLACE WITH ] et n'appliquez pas celui-ci.
#

// www.phpBB-SEO.com SEO TOOLKIT BEGIN
$highlight_ok = ($highlight !='') ? "&highlight=$highlight" : '';
// www.phpBB-SEO.com SEO TOOLKIT END


Code: Select all
#
#-----[ FIND ]------------------------------------------
#

function append_sid($url, $non_html_amp = false)
{
   global $SID;

   if ( !empty($SID) && !preg_match('#sid=#', $url) )
   {
      $url .= ( ( strpos($url, '?') !== false ) ?  ( ( $non_html_amp ) ? '&' : '&' ) : '?' ) . $SID;
   }

   return $url;
}

#
#-----[ REPLACE WITH ]------------------------------------------
#
# Dans les modifications suivante, veuillez lire les commentaires. Ils concernent le mod mx Sitemaps
# ( http://boards.phpbb-seo.com/phpbb-seo-mods/mx-site-map-module-vt4.html ) et mxBB Portal.
# Décommentez ou supprimez les lignes de code requises celon votre utilisation.
#

function append_sid($url, $non_html_amp = false)
{
   global $SID;
   // www.phpBB-SEO.com SEO TOOLKIT BEGIN
   global $phpEx;
   $amp = ($non_html_amp) ? '&' : '&';
   $find = array(   $amp.'start=0',
         $amp.'postdays=0',
         $amp.'topicdays=0',
         $amp.'postorder=asc',
         $amp.'order=DESC',
         $amp.'sort=lastpost',
      );
   $url = str_replace ($find, "", $url);
   $urlin = array(   "'(?)index.".$phpEx."\?f=([0-9]+)".$amp."ppage=([0-9]+)".$amp."start=([0-9]+)(".$amp."){0,1}'",
         "'(?)index.".$phpEx."\?f=([0-9]+)".$amp."start=([0-9]+)".$amp."ppage=([0-9]+)(".$amp."){0,1}'",
         "'(?)index.".$phpEx."\?f=([0-9]+)".$amp."ppage=([0-9]+)(".$amp."){0,1}'",
         "'(?)index.".$phpEx."\?f=([0-9]+)(".$amp."){0,1}'",
         "'(?)viewtopic.".$phpEx."\?t=([0-9]+)".$amp."start=([0-9]+)(".$amp."){0,1}'"  ,
         "'(?)viewtopic.".$phpEx."\?t=([0-9]+)(".$amp."){0,1}'",
         "'(?)viewtopic.".$phpEx."\?p=([0-9]+)(".$amp."){0,1}'",
         "'(?)profile.".$phpEx."\?mode\=viewprofile".$amp."u=([0-9]+)(".$amp."){0,1}'",
         // mx Sitemaps Module (Paginated Forum URL)
         //"'(?)forum-map([0-9]+)\.html".$amp."start=([0-9]+)(".$amp."){0,1}'",
         // mx Sitemaps Module (mxBB map URL + pagination)
         //"'(?)mx-map\.html".$amp."start=([0-9]+)(".$amp."){0,1}'"
   );
   $urlout = array( "forum\\1-\\2-\\3.html".if_query('\\4')."",
          "forum\\1-\\3-\\2.html".if_query('\\4')."",
          "forum\\1".if_first('\\2').".html".if_query('\\3')."",
          "forum\\1.html".if_query('\\2')."",
          "topic\\1-\\2.html".if_query('\\3')."",
          "topic\\1.html".if_query('\\2')."",
          "post\\1.html".if_query('\\2')."",
                "membre\\1.html".if_query('\\2')."",
          // mx Sitemaps Module (Paginated Forum URL)
          //"forum-map\\1-\\2.html".if_query('\\3')."",
          // mx Sitemaps Module (mxBB map URL + pagination)
          //"mx-map-\\1.html".if_query('\\2').""
      );
   $url = preg_replace($urlin, $urlout, $url);
   $url = str_replace ('?#', '#', $url);
   $url = (substr($url, strlen($url) - 1, 1) == '?') ? substr($url, 0, strlen($url) - 1) : $url;
   // www.phpBB-SEO.com SEO TOOLKIT END

   if ( !empty($SID) && !preg_match('#sid=#', $url) )
   {
      $url .= ( ( strpos($url, '?') !== false ) ?  ( ( $non_html_amp ) ? '&' : '&' ) : '?' ) . $SID;
   }

   return $url;
}
HB.
PR0
PR0
 
Posts: 62
Joined: Thu Oct 26, 2006 1:26 am

Postby euroman » Fri Oct 27, 2006 10:35 am

Highlight search still very much active despite following instructions to deactivate it:

viewtopic.php:
Code: Select all
// www.phpBB-SEO.com SEO TOOLKIT BEGIN
'U_VIEW_TOPIC' => append_sid("viewtopic.$phpEx?" . POST_TOPIC_URL . "=$topic_id&start=$start&postdays=$post_days&postorder=$post_order"),
// www.phpBB-SEO.com SEO TOOLKIT END


search.php:
Code: Select all
// www.phpBB-SEO.com SEO TOOLKIT BEGIN
$post_url = append_sid("viewtopic.$phpEx?" . POST_POST_URL . '=' . $searchset[$i]['post_id']) . '#' . $searchset[$i]['post_id'];
// www.phpBB-SEO.com SEO TOOLKIT END


PS When I search for "car" I get the following string:
http://www.thegame-online.de/topic7.htm ... automobile

BTW How does the system know to highligt automobile also when the search only was for car and the word automobile doest not exist in the forum :shock:
euroman
PR0
PR0
 
Posts: 81
Joined: Sat Oct 21, 2006 10:18 pm

Postby dcz » Fri Oct 27, 2006 5:31 pm

@ HB.
Sorry, I fixed the translations in the package, please re download it.

And yes, the first piece of code you mention is to be place in an .htaccess file.

It is true Reg-Ex like these are found in many phpBB mod rewrite page_header.php's code changes, but here we use a different method.
There are still some Reg-EX, but they are located in append_sid() (includes/sessions.php) instead.

@ euroman
If car comes highlighted with automobile, it's because of the search_synonyms.txt in the languages folders ;)

Now, the default install, when you apply all changes, only filter the empty highlights but keep the option working.
The commentary in the install file is only here to explain how to totally get rid of the feature.

++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21219
Joined: Fri Apr 28, 2006 9:03 pm

Postby HB. » Fri Oct 27, 2006 5:35 pm

Thank you very much dcz. I'll download it today, and thank you for explaining the difference. :)
HB.
PR0
PR0
 
Posts: 62
Joined: Thu Oct 26, 2006 1:26 am

Postby dcz » Fri Oct 27, 2006 5:38 pm

You're welcome :D

I elaborated a bit more here if you're interested.

++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21219
Joined: Fri Apr 28, 2006 9:03 pm

Postby euroman » Fri Oct 27, 2006 6:22 pm

ok thanks.

I am now moving on to my real forum. the bottom of my sessions fil looks like this: (the code I am supposed to replace is not there)

//
// Append $SID to a url. Borrowed from phplib and modified. This is an
// extra routine utilised by the session code above and acts as a wrapper
// around every single URL and form action. If you replace the session
// code you must include this routine, even if it's empty.
//
function append_sid($url, $non_html_amp = false)
{
global $SID, $HTTP_SERVER_VARS;

if ( !empty($SID) && !preg_match('#sid=#', $url) && !strstr($HTTP_SERVER_VARS['HTTP_USER_AGENT'] ,'Googlebot') && !strstr($HTTP_SERVER_VARS['HTTP_USER_AGENT'] ,'slurp@inktomi.com;'))


{
$url .= ( ( strpos($url, '?') !== false ) ? ( ( $non_html_amp ) ? '&' : '&' ) : '?' ) . $SID;
}

return $url;
}


I honestly cant remember exactly why it is changed ?? Can I substitute it ?
euroman
PR0
PR0
 
Posts: 81
Joined: Sat Oct 21, 2006 10:18 pm

Postby euroman » Fri Oct 27, 2006 6:37 pm

I think its easymod...
euroman
PR0
PR0
 
Posts: 81
Joined: Sat Oct 21, 2006 10:18 pm

Postby dcz » Fri Oct 27, 2006 6:43 pm

Please use the edit option when adding some commentaries to yourself.

Then you just need to replace the entire append_sid function, it seems you already added a mod filtering SID for some bots, based on user agent :

You can safely overwrite the entire append_sid function as the guest session mod will get rid of all SIDs for guests, thus for bots.

++
Useful links :
SEO Forum || SEO Directory || SEO phpBB || Search
____________________

Liens Utiles :
Forum référencement || Annuaire référencement || Référencement phpBB || Recherche
dcz
Admin
Admin
 
Posts: 21219
Joined: Fri Apr 28, 2006 9:03 pm

Postby HB. » Fri Oct 27, 2006 7:04 pm

In your includes/sessions instructions

Code: Select all
#
#-----[ FIND ]------------------------------------------
#

function append_sid($url, $non_html_amp = false)
{
   global $SID;

   if ( !empty($SID) && !preg_match('#sid=#', $url) )
   {
      $url .= ( ( strpos($url, '?') !== false ) ?  ( ( $non_html_amp ) ? '&' : '&' ) : '?' ) . $SID;
   }

   return $url;
}

#
#-----[ REPLACE WITH ]------------------------------------------
#
# In the following code changes, please look at the comments, they concern the
# mx Sitemaps Module ( http://boards.phpbb-seo.com/phpbb-seo-mods/mx-site-map-module-vt4.html )
# and mxBB Portal. Just uncomment, to activate, or delete, if unused, the required lines of code upon your needs
#

function append_sid($url, $non_html_amp = false)
{
   global $SID;
   // www.phpBB-SEO.com SEO TOOLKIT BEGIN
   global $phpEx;
   $amp = ($non_html_amp) ? '&' : '&';
   $find = array(   $amp.'start=0',
         $amp.'postdays=0',
         $amp.'topicdays=0',
         $amp.'postorder=asc',
         $amp.'order=DESC',
         $amp.'sort=lastpost',
      );
   $url = str_replace ($find, "", $url);
   $urlin = array(   "'(?)index.".$phpEx."\?f=([0-9]+)".$amp."ppage=([0-9]+)".$amp."start=([0-9]+)(".$amp."){0,1}'",
         "'(?)index.".$phpEx."\?f=([0-9]+)".$amp."start=([0-9]+)".$amp."ppage=([0-9]+)(".$amp."){0,1}'",
         "'(?)index.".$phpEx."\?f=([0-9]+)".$amp."ppage=([0-9]+)(".$amp."){0,1}'",
         "'(?)index.".$phpEx."\?f=([0-9]+)(".$amp."){0,1}'",
         "'(?)viewtopic.".$phpEx."\?t=([0-9]+)".$amp."start=([0-9]+)(".$amp."){0,1}'"  ,
         "'(?)viewtopic.".$phpEx."\?t=([0-9]+)(".$amp."){0,1}'",
         "'(?)viewtopic.".$phpEx."\?p=([0-9]+)(".$amp."){0,1}'",
         "'(?)profile.".$phpEx."\?mode\=viewprofile".$amp."u=([0-9]+)(".$amp."){0,1}'",
         // mx Sitemaps Module (Paginated Forum URL)
         //"'(?)forum-map([0-9]+)\.html".$amp."start=([0-9]+)(".$amp."){0,1}'",
         // mx Sitemaps Module (mxBB map URL + pagination)
         //"'(?)mx-map\.html".$amp."start=([0-9]+)(".$amp."){0,1}'"
   );
   $urlout = array( "forum\\1-\\2-\\3.html".if_query('\\4')."",
          "forum\\1-\\3-\\2.html".if_query('\\4')."",
          "forum\\1".if_first('\\2').".html".if_query('\\3')."",
          "forum\\1.html".if_query('\\2')."",
          "topic\\1-\\2.html".if_query('\\3')."",
          "topic\\1.html".if_query('\\2')."",
          "post\\1.html".if_query('\\2')."",
                "membre\\1.html".if_query('\\2')."",
          // mx Sitemaps Module (Paginated Forum URL)
          //"forum-map\\1-\\2.html".if_query('\\3')."",
          // mx Sitemaps Module (mxBB map URL + pagination)
          //"mx-map-\\1.html".if_query('\\2').""
      );
   $url = preg_replace($urlin, $urlout, $url);
   $url = str_replace ('?#', '#', $url);
   $url = (substr($url, strlen($url) - 1, 1) == '?') ? substr($url, 0, strlen($url) - 1) : $url;
   // www.phpBB-SEO.com SEO TOOLKIT END

   if ( !empty($SID) && !preg_match('#sid=#', $url) )
   {
      $url .= ( ( strpos($url, '?') !== false ) ?  ( ( $non_html_amp ) ? '&' : '&' ) : '?' ) . $SID;
   }

   return $url;
}


Is this portion removing sids for guests? I already have a sid removal MOD applied and it appears that it's causing a conflict. I'm not able to located the entire code. I'm wondering if I should remove the sid MOD? Also, I did read you statement about the mx sitemap, if I don't have that MOD installed already, would that cause conflict with all that code there? Or, should I install the sitemap MODs first then come back to this one?
HB.
PR0
PR0
 
Posts: 62
Joined: Thu Oct 26, 2006 1:26 am

Re: [DEV] phpBB SEO Simple mod Rewrite V 0.0.2

Postby gowap » Fri Oct 27, 2006 9:59 pm

phpbb-seo mods do not remove sids for guests themselves.
The documentation (see first post of this topic) advise :
SeO wrote:Don't forget to install the Cyber alien Guest session mod or any other SID removal method you may prefer.

If I were you, i would take a vanilla phpbBB 2.0.21 sessions.php file, apply cyberalien's guest session mod to it and then the phpbb-seo rewrite mod.

Don't be scared about some references to the mx sitemaps mod in the code snippet you posted. If you just want rewrite, you do not need to install mx sitemaps module (or mx google sitemaps) first. There will be no conflict.
Gravure-News : la communauté francophone de la gravure de CD/DVD et son forum d'entraide.
User avatar
gowap
phpBB SEO Team
phpBB SEO Team
 
Posts: 1504
Joined: Sun May 07, 2006 10:56 pm

Postby HB. » Sat Oct 28, 2006 2:12 am

Cyber Alien's sid removal mod gets rid of this line in the sessions file. Should I reverse that edit, then apply the edit for this mod?

Code: Select all
$SID = 'sid=' . $session_id;


edit: his part of the mod calls for:

Code: Select all
#
#-----[ FIND ]---------------------------------------------
# around line 210
   $SID = 'sid=' . $session_id;

#
#-----[ REPLACE WITH ]---------------------------------------
#
   $SID = $user_id > 0 ? 'sid=' . $session_id : '';


For this mod the code instructions read
Code: Select all
#
#-----[ FIND ]------------------------------------------
#
   $SID = 'sid=' . $session_id;
#
#-----[ REPLACE WITH ]------------------------------------------
#

   // www.phpBB-SEO.com SEO TOOLKIT BEGIN
   if ( $userdata['session_user_id'] != ANONYMOUS || $userdata['session_page'] == -4 || $userdata['session_page'] == -2 )
      $SID = 'sid=' . $session_id;
   else
      $SID = '';
   // www.phpBB-SEO.com SEO TOOLKIT END
HB.
PR0
PR0
 
Posts: 62
Joined: Thu Oct 26, 2006 1:26 am

PreviousNext

Return to phpBB2 Simple mod rewrite

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 1 guest