Setting a DirectoryIndex in .htaccess

phpBB SEO Premod for phpBB3 support forum.
This premodded version of phpBB3 includes the three different type of URL rewriting for phpBB3 by phpBB SEO. It comes with several other Search Engine Optimization mods installed.

Moderator: Moderators

Setting a DirectoryIndex in .htaccess

Postby MarcoPolo » Wed Jul 16, 2008 5:09 pm

I have a question. I use the latest version of "phpBB SEO Premod" with Advanced mod rewrite. I want to use a forum as my index page, so in .htaccess I put the following line:

Code: Select all
DirectoryIndex viewforum.php?f=2


Now when I visit the index page (domain.com) the url shows as:

domain.com/forum-title-f2.html

How to make a rule so that when domain.com is visited, the url will stay as:

domain.com/ (...without "forum-title-f2.html")

Thanks in advance.
MarcoPolo
 
Posts: 2
Joined: Wed Jul 16, 2008 4:49 pm

Advertisement

Postby SeO » Wed Jul 16, 2008 10:02 pm

The DirectoryIndex should list all scripts
Code: Select all
DirectoryIndex index.php index.html index.htm


About setting a forum as the index, the problem will the the zero duplicate, since it will force the use of the attended uri example.com/forum-url.html in your case.

But you could circumvent this sort of if you would use index.html or home.html for your forum URL (the one supposed to be the index) and then edit the phpbb_seo_class.php file as explained in the install to use something like forum.html for the real forum index.
You would need to turn of the virtual folder option and activate the forum id removing in the settings.

at this stage example.com/ would still load example.com/index.php (example.com/forum.html with url rewriting), and a DirectoryIndex would not help much since it will only consider real files, but you could implement an extra rewriterule to redirect example.com/ to example.com/index.html (or home.html or whatever you decide for the forum url).

Code: Select all
RewriteRule ^/?$ /index.html [QSA,L,R=301]


before the forum rewriterules and with the proper paths and slashes. This will not work if there is a physical index.html file in the directory, but besides, it should be a way to do what you want.
SeO
Admin
Admin
 
Posts: 6334
Joined: Wed Mar 15, 2006 9:41 pm

Postby MarcoPolo » Thu Jul 17, 2008 1:36 am

That works but all the links that link to the index page {U_INDEX} are now linked to domain.com/forum.html instead of linking to domain.com/ or domain.com/index.html

What if I do the following:

1. Use DirectoryIndex viewforum.php?f=2 in the .htaccess

2. activate the forum id removing in the settings.

3. use index.html for my forum URL

4. in phpbb_seo_class.php use

Code: Select all
'index' => ''

instead of... 'index' => 'forum'

Would this cause any problems? Or I should better do it like you say and then in the templates change {U_INDEX} links with a static link to "index.html"?
MarcoPolo
 
Posts: 2
Joined: Wed Jul 16, 2008 4:49 pm

Postby SeO » Thu Jul 17, 2008 9:23 am

You can give it a try for the DirectoryIndex.

For the index link, it is build in the page_header() function in functions.php, you can hard code it there directly.
SeO
Admin
Admin
 
Posts: 6334
Joined: Wed Mar 15, 2006 9:41 pm


Return to phpBB SEO Premod

 


  • Related topics
    Replies
    Views
    Last post

Who is online

Users browsing this forum: Yahoo [Bot] and 5 guests