how can i remove index.php from first page URL ?

Discussions about the phpBB2 Forum. How to get the best from this powerful script.

Moderator: Moderators

how can i remove index.php from first page URL ?

Postby AmirAbbas » Sun Oct 29, 2006 3:14 pm

hi

i ask this questiuon in this topic and you said to me to make a new topic for it

how can i remove index.php form first page URL ?

thanks :)
User avatar
AmirAbbas
phpBB SEO Team
phpBB SEO Team
 
Posts: 534
Joined: Thu May 11, 2006 3:30 pm
Location: IRAN

Advertisement

Postby dcz » Sun Oct 29, 2006 3:50 pm

So, first you want to change the way links are outputted on your forum :

Open

Code: Select all
includes/page_header.php


Find :

Code: Select all
   'U_INDEX' => append_sid('index.'.$phpEx),


Replace with :

Code: Select all
   // www.phpBB-SEO.com SEO TOOLKIT END
   'U_INDEX' => append_sid('/'),
   // www.phpBB-SEO.com SEO TOOLKIT END



Then, we want to http 301 redirect www.example.com/phpBB/index.php to www.example.com/phpBB/ :

Open :

Code: Select all
Index.php


Find :

Code: Select all
else
{
   $mark_read = '';
}


After add :
Code: Select all
// www.phpBB-SEO.com SEO TOOLKIT BEGIN
$uri = $_SERVER['REQUEST_URI'];
If ($mark_read == '' && $viewcat == -1  && strpos($uri, "index.$phpEx")) {
   seo_redirect(PHPBB_URL);
}
// www.phpBB-SEO.com SEO TOOLKIT END


Note that I wrote this one using the function seo_redirect() and the PHPBB_URL constant, both defined in the zero dupe I just PMed you, so you'll need to install it before.

And you won't need to add :
Code: Select all
$uri = $_SERVER['REQUEST_URI'];

Twice in index.php, the first one added here will be enough ;)

++
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: 21428
Joined: Fri Apr 28, 2006 9:03 pm

Postby AmirAbbas » Wed Nov 01, 2006 7:27 am

thanks :wink:

i removed index.php forum http://forum.irani.ch
it works like a charm

our forum first page has PR4 without index.php and PR3 with index.php
it seems that pages that ended to trailing slash can obtain more pagerank than pages that ended to index.php or index.html
User avatar
AmirAbbas
phpBB SEO Team
phpBB SEO Team
 
Posts: 534
Joined: Thu May 11, 2006 3:30 pm
Location: IRAN

Postby dcz » Wed Nov 01, 2006 9:07 am

Good :D

What about the zero dupe, do you like it ;)

It's as well because backlinks do not generally include index.php.
For phpBB index, www.example.com/ we get the external backlinks, and on www.example.com/index.php the internal.

With this you concentrate both internal and external backlinks on the same URL, it can only be better :D

By the way, for those without the Zero duplicate so far, here is what to do :

Add this :
Code: Select all
// www.phpBB-SEO.com SEO TOOLKIT BEGIN
$uri = $_SERVER['REQUEST_URI'];
If ($mark_read == '' && $viewcat == -1  && strpos($uri, "index.$phpEx")) {
         header("Status: 301 Moved Permanently", FALSE, 301);
      header("Location: http://www.example.com/phpBB/");
      exit();
}
// www.phpBB-SEO.com SEO TOOLKIT END


Where you replace http://www.example.com/phpBB/ by your forum's index url.

Instead of this :

Code: Select all
// www.phpBB-SEO.com SEO TOOLKIT BEGIN
$uri = $_SERVER['REQUEST_URI'];
If ($mark_read == '' && $viewcat == -1  && strpos($uri, "index.$phpEx")) {
   seo_redirect(PHPBB_URL);
}
// www.phpBB-SEO.com SEO TOOLKIT END


In the above code suggestion ;)

++
Last edited by dcz on Mon Nov 06, 2006 6:37 pm, edited 2 times in total.
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: 21428
Joined: Fri Apr 28, 2006 9:03 pm

Postby HB. » Wed Nov 01, 2006 1:37 pm

hey dcz, thanks for all your help thus far :) You asked that I continue over in this topic. Whenever you get a chance do you think you could help me with changing the index.php for CH boards? Thank you
HB.
PR0
PR0
 
Posts: 62
Joined: Thu Oct 26, 2006 1:26 am

Postby dcz » Wed Nov 01, 2006 5:29 pm

So this means you do not find the above code in your index.php file ?

So for Categories hierarchy, you could try adding this :
Code: Select all
// www.phpBB-SEO.com SEO TOOLKIT BEGIN
$uri = $_SERVER['REQUEST_URI'];
If (substr($uri, -9, 9) == 'index.php') {
   if ( !empty($db) ) {
      $db->sql_close();
   }
      header("Status: 301 Moved Permanently", FALSE, 301);
      header("Location: http://www.example.com/phpBB/");
      exit();
}
// www.phpBB-SEO.com SEO TOOLKIT END

Right before :

Code: Select all
define('IN_PHPBB', true);


Instead.
Last edited by dcz on Mon Nov 06, 2006 6:38 pm, edited 2 times in total.
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: 21428
Joined: Fri Apr 28, 2006 9:03 pm

Postby HB. » Wed Nov 01, 2006 5:31 pm

no this was not found in the index.php. I'll try what you just posted.

Code:
Index.php


Find :

Code:
else
{
$mark_read = '';
}
HB.
PR0
PR0
 
Posts: 62
Joined: Thu Oct 26, 2006 1:26 am

Postby HB. » Wed Nov 01, 2006 5:38 pm

I tried your code, but it redirects back to my flash intro

edit: hold on about this. I forgot I had setup a redirect...let me try to remove it first to see what happens
HB.
PR0
PR0
 
Posts: 62
Joined: Thu Oct 26, 2006 1:26 am

Postby dcz » Wed Nov 01, 2006 5:43 pm

So this is because your are using a page different from index.php when accessing the forum folder (www.example.com/phpBB/ vs www.example.com/phpBB/index.php)

You probably have an index.html file to do this. Both cannot work at the same time, if you want to show you forum index without index.php, you'll need to get rid of the flash intro I am afraid.

++
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: 21428
Joined: Fri Apr 28, 2006 9:03 pm

Postby HB. » Wed Nov 01, 2006 5:47 pm

I got rid of the flash intro (this is all on a test site) I also removed the redirect in my cPanel, and now I get a white page when attempting to view the index.

I'm not quite sure what you meant about not having index.php, the path is example.com/phpbb/index.php

I do have smartor's portal installed. I don't know if that makes a difference
HB.
PR0
PR0
 
Posts: 62
Joined: Thu Oct 26, 2006 1:26 am

Postby dcz » Wed Nov 01, 2006 6:03 pm

What I mean is to do the same as here, try this link : http://www.phpbb-seo.com/boards/index.php

For the portal, yes, it does matter, but it depend if phpBB is installed in a sub folder or not.

As you can see www.phpbb-seo.com/index.php is as well taken care of, in a different folder.

If both portal and forum where in the same folder, you'd probably prefer to see portal.php loaded instead of index.php in such case.

And the same principle could be applied to portal.php, it's just on letter longer :

Code: Select all
If (substr($uri, -9, 9) == 'index.php')


would be replaced with

Code: Select all
If (substr($uri, -10, 10) == 'portal.php')


Then, sorry, I closed the db before we could even get connected to it lol, so delete :

Code: Select all
   if ( !empty($db) ) {
      $db->sql_close();
   }


In the suggested code.

++
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: 21428
Joined: Fri Apr 28, 2006 9:03 pm

Postby HB. » Wed Nov 01, 2006 6:11 pm

I think I might have confused you a little (or maybe even myself :lol: ) I just wanted to let you know I had a portal. I orginally had for example
www.example.com lead to the flash intro, but I deleted it now ( I meant to delete that long time ago). The flash intro lead to the portal, and from the portal of course you could go to the forum.
The portal.php and the forum's index.php is install on example.com/phpbb/
The portal loads just fine, but when I click the link to the forum from the portal, I get a blank white page. I hope this clears things up a little bit.
HB.
PR0
PR0
 
Posts: 62
Joined: Thu Oct 26, 2006 1:26 am

Postby dcz » Wed Nov 01, 2006 6:18 pm

hmm, a bit yes.

What append if you load example.com/phpbb/ ?

If it's a blanck page, this mean you either have a index.html blank page in the folder or that you need to set up the DirectoryIndex in your .htaccess.

to :

Code: Select all
DirectoryIndex portal.php index.php
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: 21428
Joined: Fri Apr 28, 2006 9:03 pm

Postby HB. » Wed Nov 01, 2006 6:58 pm

wow, you are good. I did have a blank index.html file, but I just recently deleted it. I tried inserting that code in the .htaccess, but its still coming up blank. I don't want to waste too much of your time. If it remains showing example.com/phpbb/index.php will that have any negative results far as SEO goes?
HB.
PR0
PR0
 
Posts: 62
Joined: Thu Oct 26, 2006 1:26 am

Postby AmirAbbas » Thu Nov 02, 2006 3:56 am

dcz wrote:What about the zero dupe, do you like it :wink:


yes :o
its perfect !!

http://forum.irani.ch/cracker-tracker-p ... t1695.html

http://forum.irani.ch/viewtopic.php?t=1695

http://forum.irani.ch/post15382.html#15382

:mrgreen:

now i removed /post from robots.txt file because all post URL redirect to proper topic URL

is it a wise act ?
after redirectiong post URL to the URL that wrote above. the shape of URL is like this

http://forum.irani.ch/cracker-tracker-p ... html#15382

whats that #15382 at the end of URL ?
how can i remove it ?
User avatar
AmirAbbas
phpBB SEO Team
phpBB SEO Team
 
Posts: 534
Joined: Thu May 11, 2006 3:30 pm
Location: IRAN

Next

Return to phpBB2 Forum

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: Google Adsense [Bot] and 8 guests