phpBB SEO
Boards
Directory  
SEO  
Downloads
  phpBB SEO : Search Engine Optimization, Directory, Forums  
Index
Forums
Annuaire
Référencement
Télécharger
 
  Search Rechercher
    Register
Username :  Password :  Log me on automatically each visit  
S'enregistrer  
 
   
Added link rewritten to root

 
Post new topic   Reply to topic    phpBB SEO » SEO Forum  » phpBB3 mod Rewrite  » Advanced SEO URL
::  
Author Message
Ciao121



Joined: 30 Oct 2007
Posts: 7

Added link rewritten to rootPosted: Mon Apr 28, 2008 9:51 am    Post subject: Added link rewritten to root

Hi, I added a link in functions.php in this way:
Code:
'U_MYLINK'       => ($auth->acl_get('a_') && $user->data['is_registered']) ? append_sid("{$phpbb_root_path}myfolder/otherfolder/index.$phpEx") : '',


But the rewritten url points to the forum root.
Maybe I have to add someting to phpbb_seo_class.php to exlude this rewrite? If yes... how? Very Happy
Back to top
Ciao121



Joined: 30 Oct 2007
Posts: 7

Added link rewritten to rootPosted: Mon Apr 28, 2008 9:57 am    Post subject: Re: Added link rewritten to root

Hi think I solved adding:

Code:
if ( !$this->seo_opt['url_rewrite'] || strpos($this->url, 'myfolder/otherfolder/') !== FALSE || defined('ADMIN_START') ) {
         return ($is_amp) ? str_replace('&', '&', $url) : $url;
      }


after

Code:
      if ( !$this->seo_opt['url_rewrite'] || strpos($this->url, 'adm/') !== FALSE || defined('ADMIN_START') ) {
         return ($is_amp) ? str_replace('&', '&', $url) : $url;
      }


in phpbb_seo_class.php.

Don't know if this is the best solution but can be useful to someone.
Back to top
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 13354

Added link rewritten to rootPosted: Tue May 06, 2008 9:15 am    Post subject: Re: Added link rewritten to root

Yes, the "problem" here is that the rewriting is based on filenames, not paths, so index.php will always be treated as the forum's index.

We did it like this because paths are not always correctly sent to append_sid() by some mods, if not at all since we originally deal with relative paths in phpBB.

It's a bit heavy to add an if check on all urls like you did for a single url.

You can do three things to circumvent the issue, you can either bypass append_sid() for this link :
Code:
'U_MYLINK'       => ($auth->acl_get('a_') && $user->data['is_registered']) ? "{$phpbb_root_path}myfolder/otherfolder/index.$phpEx" : '',


or rename the index.php file to smething else (unique).

Or, you could just stop url rewriting before the link building and start it again after :
Code:
$saved_setting = $phpbb_seo->seo_opt['url_rewrite'];
$phpbb_seo->seo_opt['url_rewrite'] = false;
// ....

'U_MYLINK'       => ($auth->acl_get('a_') && $user->data['is_registered']) ? append_sid("{$phpbb_root_path}myfolder/otherfolder/index.$phpEx") : '',

// ...
$phpbb_seo->seo_opt['url_rewrite'] = $saved_setting;


All these are more efficient than adding an if in phpbb_seo_class.php.

++

_________________
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
Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    phpBB SEO » SEO Forum  » phpBB3 mod Rewrite  » Advanced SEO URL
Page 1 of 1

Navigation Similar Topics

Jump to: