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  
 
   
Problem with index.php in subdirectories

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



Joined: 06 Sep 2008
Posts: 1

Problem with index.php in subdirectoriesPosted: Sun Sep 07, 2008 2:28 pm    Post subject: Problem with index.php in subdirectories

I have Advanced SEO URL mod installed. I installed another mod recently and have this problem.
All links from new mod which contained “index.php” in subdirectories are rewrited to index.php in main directory. For example;

I have link to mod's control panel on the index page. The link should be: mysite/subdir/subdir/index.php but when I click on it it goes to mysite/index.php The same with the links in mod's control panel. Every link which has “index.php” goes to index.php in main directory.
I have phpBB3 portal installed also.

This is my .htaccess
Code:
# Lines That should already be in your .htacess
<Files "config.php">
Order Allow,Deny
Deny from All
</Files>
<Files "common.php">
Order Allow,Deny
Deny from All
</Files>

# 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 /
# 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 ^index\.php$ index.php [QSA,L,NC]
# FORUM
RewriteRule ^[a-z0-9_-]*-f([0-9]+)/?(page([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?forum_uri=$1&t=$2&start=$4 [QSA,L,NC]
# PROFILES SIMPLE
RewriteRule ^member([0-9]+)\.html$ memberlist.php?mode=viewprofile&u=$1 [QSA,L,NC]
# USER MESSAGES SIMPLE
RewriteRule ^member([0-9]+)-(topics|posts)(-([0-9]+))?\.html$ search.php?author_id=$1&sr=$2&start=$4 [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]
# ACTIVE TOPICS
RewriteRule ^active-topics(-([0-9]+))?\.html$ search.php?search_id=active_topics&start=$2&sr=topics [QSA,L,NC]
# UNANSWERED TOPICS
RewriteRule ^unanswered(-([0-9]+))?\.html$ search.php?search_id=unanswered&start=$2&sr=topics [QSA,L,NC]
# NEW POSTS
RewriteRule ^newposts(-([0-9]+))?\.html$ search.php?search_id=newposts&start=$2&sr=topics [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 RELATED REWRITERULES

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

DirectoryIndex portal.php index.php index.html index.htm



This is in my phpbb_seo_class.php
Code:
      // Default : Used as URL when format_url would return nothing or with simple URLs
      // can be edited, requires .htaccess update.
      $this->seo_static = array( 'forum' => 'forum', 'topic' => 'topic', 'post' => 'post', 'user' => 'member', 'group' => 'group', 'index' => 'index', 'global_announce' => 'announces', 'leaders' => 'the-team', 'atopic' => 'active-topics', 'utopic' => 'unanswered', 'npost' => 'newposts', 'pagination' => 'page', 'gz_ext' => '.gz' );
      // URL suffixes, for the phpBB URLs
      // can be edited, requires .htaccess update.
      $this->seo_ext = array( 'forum' => '.html', 'topic' => '.html', 'post' => '.html', 'user' => '.html', 'group' => '.html',  'index' => '.php', 'global_announce' => '/', 'leaders' => '.html', 'atopic' => '.html', 'utopic' => '.html', 'npost' => '.html', 'pagination' => '.html', 'gz_ext' => '');
Back to top
herculepoirot



Joined: 31 Jul 2008
Posts: 5

Problem with index.php in subdirectoriesPosted: Wed Sep 10, 2008 10:35 am    Post subject: Re: Problem with index.php in subdirectories

hi there,

i've the same problems i guess.

i have installed phpbb3 portal for my main page, so in .htaccess i used directoryindex so the first thing users/members see is portal.php (by default).

then before i'm using this phpbbseo all url for index.php is written clearly (U_INDEX = phpbbroot index.php) somethin like that.


after i've activate phpbbseo then index.php never show up anymore.

so whenever i click board index or my site logo it will bring back to portal.php (already setted at htaccess directoryindex).

how to make board index showing again without removing my default indexdirectory of course?


thanks...

(sorry i've made mistake by posting here.. newbie Embarassed and yeah not to mention my bad english Sad sorry)
Back to top
dcz
Administrateur - Site Admin
Administrateur - Site Admin


Joined: 28 Apr 2006
Posts: 15242

Problem with index.php in subdirectoriesPosted: Sat Sep 13, 2008 1:03 pm    Post subject: Re: Problem with index.php in subdirectories

@herculepoirot :

install wrote:
=> By Default, this mod will get rid of index.php for phpBB's index.
You can change this in phpbb_seo/phpbb_seo_class.php if you prefer.
Look for :

'index' => ''

In this line of code :

$this->seo_static = array( 'forum' => 'forum', 'topic' => 'topic', 'post' => 'post', 'user' => 'member', 'group' => 'group', 'index' => '', 'global_announce' => 'announces', 'leaders' => 'the-team', 'atopic' => 'active-topics', 'utopic' => 'unanswered', 'npost' => 'newposts', 'pagination' => 'page', 'gz_ext' => '.gz' );

And replace :

'index' => ''

with :

'index' => 'forum'

or whatever you may prefer.
This is mostly useful if you're running a portal in the folder where phpBB is installed.


This way phpBB index will be rewritten to -www.example.com/phpbb/forum.html, letting -www.example.com/phpbb/ free for the portal with the directoryindex poperly set in .htaccess.

@sotis, this is a limitation of the current version, the rewriting is based on filenames, so each files passing through append_sid should have a different name.

You can though circumvent the issue if you add :
Code:
      if ($this->filename == 'index') {
         $this->rewrite_functions['index'] = strpos($this->path, "path/to/filter/") !== false ? false : 'index';
      }


before :
Code:
      if ( !empty($this->rewrite_functions[$this->filename]) ) {


in phpbb_seo/phpbb_seo_class.php.

You could as well use :

Code:
      if ($this->filename == 'index') {
         $this->rewrite_functions['index'] = strpos($this->path, "path/to/filter/") !== false ? 'name_of_the_rewriting_function_to_use' : 'index';
      }


If you'd want to perform some url rewriting for the extra index.php with a additional function in the class.
This solution is not very optimized if you have to filter many paths with index.php files in it, but it's ok for one or two.

++

_________________
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: