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  
 
   
Rewrite of phpBB3 Gallery index.php
Goto page 1, 2  Next
 
Post new topic   Reply to topic    phpBB SEO » SEO Forum  » phpBB3 mod Rewrite  » Advanced SEO URL
::  
Author Message
DaMysterious



Joined: 10 Mar 2008
Posts: 9
Location: The Netherlands

Rewrite of phpBB3 Gallery index.phpPosted: Mon Mar 10, 2008 6:41 pm    Post subject: Rewrite of phpBB3 Gallery index.php

I have a problem rewriting index.php of our included gallery mod from here http://www.flying-bits.org/viewtopic.php?f=16&t=31.

Our Portal XL 4.0 Premod uses Advanced phpBB3 SEO mod Rewrite 0.4.0 which works as expected. However we have a small problem as I'm not fully familiar with rewrite rules.

Following scenario:
If rewrite of forum/index.php is enabled the link is translated to forum.html exactly.

Above described gallery remains and is called from out of directory forum/gallery/index.php. That link is translated to forum.html also which is not the intention.

On portal.php and calandar.php the rewrite rules do work perfectly.

My rewrite rule
Code:

#####################################################
# You may need to un-comment the following line
Options +FollowSymlinks
# REMEBER YOU ONLY NEED TO STARD MOD REWRITE ONCE
RewriteEngine On
# REWRITE BASE
RewriteBase /plusxl40/
# HERE IS A GOOD PLACE TO ADD THE WWW PREFIXE REDIRECTION

#####################################################
# PHPBB SEO REWRITE RULES - ADVANCED
#####################################################
# AUTHOR : dcz www.phpbb-seo.com
# STARTED : 01/2006
#################################
# FORUMS PAGES
###############
# FORUM INDEX
RewriteRule ^forum\.html$ index.php [QSA,L,NC]
# FORUM
RewriteRule ^[a-z0-9_-]*-f([0-9]+)(-([0-9]+))?\.html$ viewforum.php?f=$1&start=$3 [QSA,L,NC]
# TOPIC WITH VIRTUAL FOLDER
RewriteRule ^[a-z0-9_-]*-f([0-9]+)/[a-z0-9_-]*-t([0-9]+)(-([0-9]+))?\.html$ viewtopic.php?f=$1&t=$2&start=$4 [QSA,L,NC]
# GLOBAL ANNOUNCES WITH VIRTUAL FOLDER
RewriteRule ^announces/[a-z0-9_-]*-t([0-9]+)(-([0-9]+))?\.html$ viewtopic.php?t=$1&start=$3 [QSA,L,NC]
# TOPIC WITHOUT FORUM ID & DELIM
RewriteRule ^[a-z0-9_-]*/?[a-z0-9_-]*-t([0-9]+)(-([0-9]+))?\.html$ viewtopic.php?t=$1&start=$3 [QSA,L,NC]
# PROFILES SIMPLE
RewriteRule ^member([0-9]+)\.html$ memberlist.php?mode=viewprofile&u=$1 [QSA,L,NC]
# USER MESSAGES SIMPLE
RewriteRule ^messages([0-9]+)(-([0-9]+))?\.html$ search.php?author_id=$1&sr=posts&start=$3 [QSA,L,NC]
# GROUPS SIMPLE
RewriteRule ^group([0-9]+)(-([0-9]+))?\.html$ memberlist.php?mode=group&g=$1&start=$3 [QSA,L,NC]
# POST
RewriteRule ^post([0-9]+)\.html$ viewtopic.php?p=$1 [QSA,L,NC]
# THE TEAM
RewriteRule ^the-team\.html$ memberlist.php?mode=leaders [QSA,L,NC]
# HERE IS A GOOD PLACE TO ADD OTHER PHPBB / PORTAL RELATED REWRITERULES
RewriteRule ^portal\.html$ portal.php [QSA,L,NC]
RewriteRule ^calendar\.html$ calendar.php [QSA,L,NC]
RewriteRule ^gallery\gallery\.html$ gallery\index.php [QSA,L,NC]

# FORUM WITHOUT ID & DELIM
# THESE FOUR LINES MUST BE LOCATED AT THE END OF YOUR HTACCESS TO WORK PROPERLY
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-l
RewriteRule ^[a-z0-9_-]+(-([0-9]+))?\.html$ viewforum.php?start=$2 [QSA,L,NC]
# END PHPBB PAGES
#####################################################


Can some one have a look at this please? I can not get this fixed.
Link to our site http://damysterious.xs4all.nl/plusxl40/portal.html if needed.


Last edited by DaMysterious on Thu Mar 13, 2008 8:41 am; edited 1 time in total
Back to top
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 13354

Rewrite of phpBB3 Gallery index.phpPosted: Wed Mar 12, 2008 5:06 pm    Post subject: Re: Rewrite of phpBB3 Gallery index.php

And welcome Very Happy

So, the problem here is that the method used does not take paths into account (to go as fast as possible), it only relies on file-name to do the rewriting.

The easiest workaround for this for sure is to rename the gallery index.php file to for example gallery.php, could not mean necessary this much work to fix all the outputted links as well. This way the link would be left as is.

You could as well rename the phpBB's index.php file to for example forum.php, making sure you do it everywhere in the code and in the .htaccess.

Or, you could as well implement a new constant you would define in the gallery's index.php, at the very beginning :
Code:
define('IN_GALLERY', true);


and then use it in the phpbb_seo_class.php index() method replacing :
Code:
      $this->path = $this->seo_path['phpbb_urlR'];
      $this->url = $this->seo_static['index'] . $this->seo_ext['index'];


with :
Code:
      if (defined('IN_GALLERY')) {
         $this->path = $this->seo_path['root_url'] . 'gallery/';
         $this->url = 'index.html';
      } else {
         $this->path = $this->seo_path['phpbb_urlR'];
         $this->url = $this->seo_static['index'] . $this->seo_ext['index'];
      }


You'd only have to add the proper rewriterule for gallery/index.html (you can set index.php or whatever you prefer too).

Wink

++

_________________
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 Wed Mar 12, 2008 10:32 pm; edited 1 time in total
Back to top
Visit poster's website
GoBieN
PR0
PR0


Joined: 10 Mar 2008
Posts: 53
Location: Belgium

Rewrite of phpBB3 Gallery index.phpPosted: Wed Mar 12, 2008 10:21 pm    Post subject: Re: Rewrite of phpBB3 Gallery index.php

@Damysteriuos:
I added the code as dcz suggested, and some adjustement and now it all works for me, here are my steps:
1) Added:
Code:
define('IN_GALLERY', true);

In every file in the directory "gallery", (not the other sub-dirs).

2) Don't use the fix dcz suggested it will not solve everything. And is not needed for my approach. (no offence dcz)

3) I renamed gallery/index.php to gallery/gallery.php

4) In includes/functions.php
FIND:
Code:
      'U_GALLERY_MOD'      => append_sid("{$phpbb_root_path}gallery/index.$phpEx"),

REPLACE WITH:
Code:
      'U_GALLERY_MOD'      => append_sid("{$phpbb_root_path}gallery/gallery.$phpEx"),


5) in your .htaccess add following redirect:
Code:
RewriteRule ^gallery/index\.php$ gallery/gallery.php [QSA,L,R=301]

Note: This rule is when your phpbb is in your root, and not in a subdir, for subdir the rule is a little different, give a shout and i'll post it.

6) In gallery/gallery.php
FIND:
Code:
   'U_USERS_PERSONAL_GALLERIES'    => append_sid("{$phpbb_root_path}{$gallery_root_path}index.$phpEx", 'mode=personal'),

REPLACE WITH:
Code:
   'U_USERS_PERSONAL_GALLERIES'    => append_sid("{$phpbb_root_path}{$gallery_root_path}gallery.$phpEx", 'mode=personal'),

FIND:
Code:
      'U_VIEW_FORUM'   => append_sid("{$phpbb_root_path}{$gallery_root_path}index.$phpEx", 'mode=personal'))

REPLACE WITH:
Code:
      'U_VIEW_FORUM'   => append_sid("{$phpbb_root_path}{$gallery_root_path}gallery.$phpEx", 'mode=personal'))


7) In all files in gallery/includes/* look for index.$phpEx and change to gallery.$phpEx

8) In styles/templates/prosilver/gallery_album_body.html
FIND:
Code:
<p><a href="{U_RETURN_LINK}" class="left-box {S_CONTENT_FLOW_BEGIN}" accesskey="r">{L_RETURN_TO} {S_RETURN_LINK}</a></p>

REPLACE WITH:
Code:
<p><a href="{U_GALLERY_MOD}" class="left-box {S_CONTENT_FLOW_BEGIN}" accesskey="r">{L_RETURN_TO} {S_RETURN_LINK}</a></p>


9) When SEOmod is active i noticed that there were no thumbnails showing and on some album pages i got a php notice about an not existing index "is_registered" in file phpbb_seo_class.php. I fixed this like this:
in php_seo_class.php
FIND:
Code:
         if ( !$user->data['is_registered'] ) {
            if ( $this->seo_opt['rem_sid'] ) {
               unset($this->get_vars['sid']);
            }
            if ( $this->seo_opt['rem_hilit'] ) {
               unset($this->get_vars['hilit']);
            }
      }

REPLACE WITH:
Code:
      if (!defined('IN_GALLERY')){
         if ( !$user->data['is_registered'] ) {
            if ( $this->seo_opt['rem_sid'] ) {
               unset($this->get_vars['sid']);
            }
            if ( $this->seo_opt['rem_hilit'] ) {
               unset($this->get_vars['hilit']);
            }
         }
      }


10) In viewonline.php
FIND (partial line):
Code:
{$gallery_root_path}index.$phpEx

REPLACE WITH: (several times)
Code:
{$gallery_root_path}gallery.$phpEx

For some reason i had erros on viewonline.php saying i could not find $gallery_root_path
I added the line: $gallery_root_path = "gallery/";
right below the line: // Get and set some variables



I'm testing everything now, but it seems to all work well !


edit: Changed some things at 13 march 00:07


Last edited by GoBieN on Wed Mar 12, 2008 11:46 pm; edited 3 times in total
Back to top
Visit poster's website
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 13354

Rewrite of phpBB3 Gallery index.phpPosted: Wed Mar 12, 2008 10:38 pm    Post subject: Re: Rewrite of phpBB3 Gallery index.php

Sorry for the typo, post edited Wink

Anyway, with this last fix, the idea was that you should not need any more code changes, the gallery's index should be rewritten directly to example.com/gallery/index.html

and you only need to add something like (depending on your paths and how you chosen to rewrite the gallery index) :
Code:
RewriteRule ^gallery/index\.html$ gallery/index.php [QSA,L,NC]


in the .htaccess.

Your trick for sessions and highlights may still be required, you could add the check in the constructor to go faster though :

Code:
      if (!defined('IN_GALLERY')){
            $this->seo_opt['rem_sid'] = false;
      }


right after :

Code:
      if ( !defined('ADMIN_START') && in_array($this->seo_opt['req_file'], $this->seo_opt['file_hbase'])) {   
         $this->seo_opt['seo_base_href'] = '<base href="' . $this->seo_path['phpbb_url'] . '"/>';
      }


Now, I'm saying this blinded, I did not install the gallery mod yet Wink

By the way, since this mod is based on the smartor album, it may not be this difficult to port the phpBB2 smartor url rewriting mod Wink

++

_________________
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
GoBieN
PR0
PR0


Joined: 10 Mar 2008
Posts: 53
Location: Belgium

Rewrite of phpBB3 Gallery index.phpPosted: Wed Mar 12, 2008 10:54 pm    Post subject: Re: Rewrite of phpBB3 Gallery index.php

dcz wrote:
Sorry for the typo, post edited Wink

Anyway, with this last fix, the idea was that you should not need any more code changes, the gallery's index should be rewritten directly to example.com/gallery/index.html

and you only need to add something like (depending on your paths and how you chosen to rewrite the gallery index) :
Code:
RewriteRule ^gallery/index\.html$ gallery/index.php [QSA,L,NC]


in the .htaccess.

....

By the way, since this mod is based on the smartor album, it may not be this difficult to port the phpBB2 smartor url rewriting mod Wink

++

With your easy fix, the problem is that the link to the gallery is in the header (next to help and members) and so is displayed on every page forum wide ! And since in the forum the IN_GALLERY is not defined, the URL gets rewritten wrong again ! So you simply can not reach the gallery !
As you said, you don't check for sub paths but only on filenames i realized the only good way would be to rename the gallery index file. ofcourse this has consequences and thus needs a few adjustements.

As far as the old smartor rewrite mod goes, i think to much has changed in the current gallery for it to be that easy. Altough perhaps only the filnames and paths have changed mostly.
Back to top
Visit poster's website
GoBieN
PR0
PR0


Joined: 10 Mar 2008
Posts: 53
Location: Belgium

Rewrite of phpBB3 Gallery index.phpPosted: Wed Mar 12, 2008 11:04 pm    Post subject: Re: Rewrite of phpBB3 Gallery index.php

GoBieN wrote:
@dcz:
I have it all sorted except 1 thing. Now the gallery URL doesn't get rewritten, but the link for the forumindex is wrong now.

Example, when i'm in the gallery the header states:
Quote:
* Portal » Forumindex ‹ Gallery ‹ Album name

The forum index links to gallery/index.php so this is wrong. Any chance i can fix this, without undoing the changes you suggested that leads to gallery working now !


If all my changes have been done, you can simply change your fix back to the original:
$this->path = $this->seo_path['phpbb_urlR'];
$this->url = $this->seo_static['index'] . $this->seo_ext['index'];

And the problem goes away. I wil edit my post to, to remove your fix.
Back to top
Visit poster's website
DaMysterious



Joined: 10 Mar 2008
Posts: 9
Location: The Netherlands

Rewrite of phpBB3 Gallery index.phpPosted: Thu Mar 13, 2008 8:30 am    Post subject: Re: Rewrite of phpBB3 Gallery index.php

Renaming gallery's index to gallery.$phpEx will conflict with phpBB3's internal avatar feature which is called gallery to, especially in subsilver2 related styles.

I'm close before release of our RC4 with not any time to experiment with the internal SEO I decided to rename index.php to index_album.php and all files related (in folder includes to) as first fix.

Thanks for all your thoughts. Continuing at later stage is very much appreciated.


Last edited by DaMysterious on Thu Mar 13, 2008 8:44 am; edited 1 time in total
Back to top
DaMysterious



Joined: 10 Mar 2008
Posts: 9
Location: The Netherlands

Rewrite of phpBB3 Gallery index.phpPosted: Thu Mar 13, 2008 8:37 am    Post subject: Re: Rewrite of phpBB3 Gallery index.php

GoBieN wrote:

5) in your .htaccess add following redirect:
Code:
RewriteRule ^gallery/index\.php$ gallery/gallery.php [QSA,L,R=301]

Note: This rule is when your phpbb is in your root, and not in a subdir, for subdir the rule is a little different, give a shout and i'll post it.


RewriteBase = /plusxl40/ in a subdir, what are the changes for that?
Back to top
DaMysterious



Joined: 10 Mar 2008
Posts: 9
Location: The Netherlands

Rewrite of phpBB3 Gallery index.phpPosted: Thu Mar 13, 2008 8:47 am    Post subject: Re: Rewrite of phpBB3 Gallery index.php

DaMysterious wrote:
Renaming gallery's index to gallery.$phpEx will conflict with phpBB3's internal avatar feature which is called gallery to, especially in subsilver2 related styles. dcz suggestions will work only if in gallery already, but will not affect the board wide navlinks of the gallery.

I'm close before release of our RC4 with not any time to experiment with the internal SEO I decided to rename index.php to index_album.php and all files related (in folder includes to) as first fix.

Thanks for all your thoughts. Continuing at later stage is very much appreciated.
Back to top
GoBieN
PR0
PR0


Joined: 10 Mar 2008
Posts: 53
Location: Belgium

Rewrite of phpBB3 Gallery index.phpPosted: Thu Mar 13, 2008 10:16 pm    Post subject: Re: Rewrite of phpBB3 Gallery index.php

DaMysterious wrote:
GoBieN wrote:

5) in your .htaccess add following redirect:
Code:
RewriteRule ^gallery/index\.php$ gallery/gallery.php [QSA,L,R=301]

Note: This rule is when your phpbb is in your root, and not in a subdir, for subdir the rule is a little different, give a shout and i'll post it.


RewriteBase = /plusxl40/ in a subdir, what are the changes for that?


Here are my rules.
Code:
RewriteRule ^gallery/index\.php$ phpBB3/gallery/gallery.php [QSA,L,R=301]
RewriteRule ^phpBB3/gallery/index\.php$ phpBB3/gallery/gallery.php [QSA,L,R=301]

For you that would be:
Code:
RewriteRule ^gallery/index\.php$ plusxl40/gallery/index_album.php [QSA,L,R=301]
RewriteRule ^plusxl40/gallery/index\.php$ plusxl40/gallery/index_album.php [QSA,L,R=301]
Back to top
Visit poster's website
GoBieN
PR0
PR0


Joined: 10 Mar 2008
Posts: 53
Location: Belgium

Rewrite of phpBB3 Gallery index.phpPosted: Thu Mar 13, 2008 10:18 pm    Post subject: Re: Rewrite of phpBB3 Gallery index.php

DaMysterious wrote:
Renaming gallery's index to gallery.$phpEx will conflict with phpBB3's internal avatar feature which is called gallery to, especially in subsilver2 related styles.

I'm close before release of our RC4 with not any time to experiment with the internal SEO I decided to rename index.php to index_album.php and all files related (in folder includes to) as first fix.

Thanks for all your thoughts. Continuing at later stage is very much appreciated.

I use only prosilver, had no idea about the avatar thing. Do you think i will run into problems with the name ?
Back to top
Visit poster's website
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 13354

Rewrite of phpBB3 Gallery index.phpPosted: Sun Mar 23, 2008 2:00 pm    Post subject: Re: Rewrite of phpBB3 Gallery index.php

GoBieN wrote:

As far as the old smartor rewrite mod goes, i think to much has changed in the current gallery for it to be that easy. Altough perhaps only the filnames and paths have changed mostly.


That was not my impression after a quick look at the new gallery mod's code, but of course, porting the code implies some coding, especially in the phpbb_seo_class.php file, the class is a bit different in phpBB3.

Then, about the way to fix the gallery's index, renaming the gallery index.php file seems to be the best way in the end.

DaMysterious wrote:
RewriteBase = /plusxl40/ in a subdir, what are the changes for that?


do you need the rewritebase param because your phpBB3's .htaccess is in the example.com/plusxl40/ dir ?

Using a non empty rewritebase most of the time requires getting rid of the right slash in the rewriterules (the one before the script path on the right part), in your .htaccess, if there is a rewritebase or not, you should only have to add the same slashes and eventually path on all the rewriterules.

@GoBieN

I don't get the idea behind :

Code:
RewriteRule ^gallery/index\.php$ phpBB3/gallery/gallery.php [QSA,L,R=301]
RewriteRule ^phpBB3/gallery/index\.php$ phpBB3/gallery/gallery.php [QSA,L,R=301]


This will create a duplicate, since both example.com/gallery/index.php and example.com/phpBB3/gallery/index.php will lead to the same file and page.

The logic would be to only use one of the two once and for all.

++

_________________
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
GoBieN
PR0
PR0


Joined: 10 Mar 2008
Posts: 53
Location: Belgium

Rewrite of phpBB3 Gallery index.phpPosted: Sun Mar 23, 2008 4:18 pm    Post subject: Re: Rewrite of phpBB3 Gallery index.php

dcz wrote:

@GoBieN

I don't get the idea behind :

Code:
RewriteRule ^gallery/index\.php$ phpBB3/gallery/gallery.php [QSA,L,R=301]
RewriteRule ^phpBB3/gallery/index\.php$ phpBB3/gallery/gallery.php [QSA,L,R=301]


This will create a duplicate, since both example.com/gallery/index.php and example.com/phpBB3/gallery/index.php will lead to the same file and page.

The logic would be to only use one of the two once and for all.

++


I did this because the the phpBB3 part was missing on some of the links.
Instead of going trough all the code and fixing that, i just added a second rule. I don't believe this will give problems because it's a 301 redirect ! So it's not really a dupe.
Back to top
Visit poster's website
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 13354

Rewrite of phpBB3 Gallery index.phpPosted: Mon Mar 24, 2008 1:28 pm    Post subject: Re: Rewrite of phpBB3 Gallery index.php

Ok, and you're right, I missed the 301 flag Wink

So this means you did not make it to build the gallery links properly, even though you renamed all the occurrences of the gallery's index.php within the php files (where the link is built) ?

++

_________________
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
GoBieN
PR0
PR0


Joined: 10 Mar 2008
Posts: 53
Location: Belgium

Rewrite of phpBB3 Gallery index.phpPosted: Mon Mar 24, 2008 2:26 pm    Post subject: Re: Rewrite of phpBB3 Gallery index.php

dcz wrote:
Ok, and you're right, I missed the 301 flag Wink

So this means you did not make it to build the gallery links properly, even though you renamed all the occurrences of the gallery's index.php within the php files (where the link is built) ?

++

I checked all my links, and it seems all of them are fine.
I think i added that line before i had them all sorted out.
I think it could be deleted, but i'll keep it just to be sure Wink

Your mod is working out great for me.
I just have one tiny problem regarding the rewrites, but i'll start a new topic.
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 2 Goto page 1, 2  Next

Navigation Similar Topics

Jump to: