Renaming index.php to forum.php

Zero duplicate support forum.
Personalized HTTP 301 dynamic redirections.

Moderator: Moderators

Renaming index.php to forum.php

Postby Horizon70s » Wed Jan 21, 2009 11:51 pm

I'm assuming there's 2 ways of doing it. The one would be to change all the hardcoding like the url below:

http://www.phpbb.com/community/viewtopi ... &t=1225125

The other would be to use the redirect in this mod from index.php to forum.php


My forum is currently mysite.com/forum.php and I'd prefer to keep it that way for consistency. Would you recommend this mod over hardcoding for SEO reasons?

Thanks
Horizon70s
 
Posts: 32
Joined: Wed Jan 21, 2009 4:06 pm

Advertisement

Postby SeO » Fri Jan 23, 2009 2:24 pm

The simplest wa to do so is just to set this up in phpbb_seo_class.php :
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 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 exactely would end up using forum.html, you can use forum.php if you additionnaly replace :

Code: Select all
      $this->seo_ext = array( 'forum' => '.html', 'topic' => '.html', 'post' => '.html', 'user' => '.html', 'group' => '.html',  'index' => '', 'global_announce' => '/', 'leaders' => '.html', 'atopic' => '.html', 'utopic' => '.html', 'npost' => '.html', 'pagination' => '.html', 'gz_ext' => '');

with :
Code: Select all
      $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' => '');


Just generate a new .htaccess once done ;)
SeO
Admin
Admin
 
Posts: 6333
Joined: Wed Mar 15, 2006 9:41 pm

Postby Horizon70s » Fri Jan 23, 2009 5:09 pm

It's not working, still forwarding to the folder root instead "/".

I'm testing this on a test site....and I'm currently testing with:

mysite.com/phpbb/

Where I want it to work in the test site as:

mysite.com/phpbb/forum.php


I'm not able to get it working with the instructions you supplied. I've added the .htaccess at the root (mysite.com/.htaccess) and I even tried it with using the .htaccess in the subdirectory with no avail.

I'm wondering if it's b/c I have it in a subdirectory even though I instructed that I wanted it to be forum.php at the root?

Many, many thanks for your time.
Horizon70s
 
Posts: 32
Joined: Wed Jan 21, 2009 4:06 pm

Postby SeO » Fri Jan 23, 2009 7:50 pm

Have you edited the phpbb_seo_class.php file ?
SeO
Admin
Admin
 
Posts: 6333
Joined: Wed Mar 15, 2006 9:41 pm

Postby Horizon70s » Fri Jan 23, 2009 7:53 pm

SeO wrote:Have you edited the phpbb_seo_class.php file ?


Yes I have, with the instructions above.
Horizon70s
 
Posts: 32
Joined: Wed Jan 21, 2009 4:06 pm

Postby SeO » Fri Jan 23, 2009 7:55 pm

Did you actually rename index.php to forum.php, because you're not supposed to using url rewriting as suggested.
SeO
Admin
Admin
 
Posts: 6333
Joined: Wed Mar 15, 2006 9:41 pm

Postby Horizon70s » Fri Jan 23, 2009 9:26 pm

No, it's still index.php

BTW - won't it matter that I will be using index.php for my CMS?
Horizon70s
 
Posts: 32
Joined: Wed Jan 21, 2009 4:06 pm

Postby Horizon70s » Fri Jan 23, 2009 11:52 pm

I'm moving my test site to another domain that does everything from the root, like I will be merging to. This will make it easier to diagnose issues.

After I made the move, everything keeps forwarding back to the old address. Even if I change the server settings to the new domain...it keeps redirecting back to the old domain.

I can't find a file or db setting that keeps causing this?
Horizon70s
 
Posts: 32
Joined: Wed Jan 21, 2009 4:06 pm

Postby SeO » Sat Jan 24, 2009 10:01 am

An option that can help you in such case is the virtual root option, which will simulate root url for all rewritten forum urls with phpBB installed in a sub dir.

Then, I don't see how the above method could fail, with only the firt edit :
Code: Select all
'index' => ''

to :
Code: Select all
'index' => 'forum'

in :
Code: Select all
$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' );


You should end up with forum.html for the forum index, you need the second one to use forum.php, in both cases you need to generate a new .htaccess once done to have the new url working.

For the server setting update, if you did this using phpmyadmin, you need to clear phpbb's cache before the new settings will be usable. You'll may need to properly chmod the cache/ dir in case you changed the physical location of the files too.
Proper domain settings when phpbb installed in sub.example.com/phpBB/ (where sub. could be www. or nothing, and phpBB/ something else or nothing) is :
Code: Select all
server domain :sub.example.com
script path: /phpBB
cookie domain:.example.com

with the dot for the cookie.
SeO
Admin
Admin
 
Posts: 6333
Joined: Wed Mar 15, 2006 9:41 pm

Postby Horizon70s » Wed Jan 28, 2009 6:15 pm

Thanks a lot...I got it all cleaned up.

One quick question...I am currently using index.php (or the root actually) for the home page of my CMS...the forum will be forum.php - this basically eliminates the CMS index and always forwards to the forum....any workarounds for this?
Horizon70s
 
Posts: 32
Joined: Wed Jan 21, 2009 4:06 pm

Postby SeO » Thu Jan 29, 2009 10:00 am

Virtual root is here for this, you can run phpBB in a sub dir and simulate root url for all rewritten urls.
This option would allow you to use an index.php file in the domain's root without messing with phpBB ;)
SeO
Admin
Admin
 
Posts: 6333
Joined: Wed Mar 15, 2006 9:41 pm


Return to Zero duplicate phpBB2

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: No registered users and 8 guests