Results 1 to 15 of 15

Rewrite index.php and index.php? to a folder.

This is a discussion on Rewrite index.php and index.php? to a folder. within the General Discussion forums, part of the vBulletin SEO Discussion category; Sorry if this has been done, but I have been looking for a while. How do you simply ensure all ...

  1. #1
    Senior Member
    Real Name
    Matthew
    Join Date
    Nov 2006
    Posts
    127
    Liked
    0 times

    Rewrite index.php and index.php? to a folder.

    Sorry if this has been done, but I have been looking for a while.

    How do you simply ensure all URL's folder/index.php & folder/index.php? redirect to folder/. I have tried various ways but I just seem to end up with an infinate loop. I am trying with 'gallery' at the moment.

  2. #2
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,689
    Liked
    157 times
    Hello,

    you should enable "Force Forum Root as Homepage?" option in vbseocp and define Homepage Aliases as:
    Code:
    index.php
    index.php?
    Oleg Ignatiuk / Crawlability Inc.
    vBSEO 3.6.0 GOLD Released!
    Unveiling the NEW vBSEO Sitemap Generator 3.0. - available NOW for vBSEO Customers!


  3. #3
    Senior Member
    Real Name
    Matthew
    Join Date
    Nov 2006
    Posts
    127
    Liked
    0 times
    That works fine for the root, but it doesn't seem to affect the subfolders.

  4. #4
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,689
    Liked
    157 times
    Try to manually enable this option in config_vbseo.php file:
    PHP Code:
        define('VBSEO_FORCEHOMEPAGE_ROOT',  1); 
    Oleg Ignatiuk / Crawlability Inc.
    vBSEO 3.6.0 GOLD Released!
    Unveiling the NEW vBSEO Sitemap Generator 3.0. - available NOW for vBSEO Customers!


  5. #5
    Senior Member
    Real Name
    Matthew
    Join Date
    Nov 2006
    Posts
    127
    Liked
    0 times
    That option is enabled correctly.

    I need to do this with subfolders.

    E.g. mysite.com/gallery, mysite.com/links e.t.c.

  6. #6
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,689
    Liked
    157 times
    Perhaps the simplest way is to modify the links in templates for that.
    Otherwise, you can modify "vBSEO Global Hook" plugin in vB admincp by adding the following to it:
    PHP Code:
    $output str_replace('mysite.com/gallery/index.php''mysite.com/gallery/'$output); 
    Oleg Ignatiuk / Crawlability Inc.
    vBSEO 3.6.0 GOLD Released!
    Unveiling the NEW vBSEO Sitemap Generator 3.0. - available NOW for vBSEO Customers!


  7. #7
    Senior Member
    Real Name
    Matthew
    Join Date
    Nov 2006
    Posts
    127
    Liked
    0 times
    I see what you mean about the templates, but it's more bookmarks and links on-line that are the issue. Want them all directed to the same folder to preserve PR. I will use the above method, thanks... Is that a 301?

    Edit: The above method didn't work. Here is the contents of that plugin.
    if(@include_once(($GLOBALS['vbpath']?$GLOBALS['vbpath'].'/includes':dirname(__FILE__)).'/functions_vbseo.php'))
    $output = make_crawlable($output);
    $output = str_replace('dragonninja.co.uk/gallery/index.php', 'dragonninja.co.uk/gallery/', $output);

  8. #8
    Senior Member
    Real Name
    Matthew
    Join Date
    Nov 2006
    Posts
    127
    Liked
    0 times
    Should I just use a stand alone .htaccess in the subfolder? I though the script could do it, but if not that is fine.

  9. #9
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,689
    Liked
    157 times
    Hello,

    if you want to redirect the links, you should add the following in root .htaccess rigth after "RewriteEngine on" line:
    Code:
    RewriteCond %{THE_REQUEST} /index\.php
    RewriteRule ^(.+/)index\.php http://www.domain.com/$1 [L,R=301]
    Oleg Ignatiuk / Crawlability Inc.
    vBSEO 3.6.0 GOLD Released!
    Unveiling the NEW vBSEO Sitemap Generator 3.0. - available NOW for vBSEO Customers!


  10. #10
    Senior Member
    Real Name
    Matthew
    Join Date
    Nov 2006
    Posts
    127
    Liked
    0 times
    Works like a dream, thanks.

    Only issue I can see is that if you go to domain.com/gallery/index.php? you are redirected to domain.com/gallery/? - will this cause problems with PR?

    Hope I am not troubling you too much on your weekend!

  11. #11
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,689
    Liked
    157 times
    Please try to change rewrite rule to:
    Code:
    RewriteRule ^(.+/)index\.php http://www.domain.com/$1? [L,R=301]
    Oleg Ignatiuk / Crawlability Inc.
    vBSEO 3.6.0 GOLD Released!
    Unveiling the NEW vBSEO Sitemap Generator 3.0. - available NOW for vBSEO Customers!


  12. #12
    Senior Member
    Real Name
    Matthew
    Join Date
    Nov 2006
    Posts
    127
    Liked
    0 times
    Brilliant, thanks.

  13. #13
    Senior Member
    Real Name
    Matthew
    Join Date
    Nov 2006
    Posts
    127
    Liked
    0 times
    It seems to be killing the vB ACP with an infinate loop. Any way to exclude the folder?

  14. #14
    vBSEO Staff Oleg Ignatiuk's Avatar
    Real Name
    Oleg Ignatiuk
    Join Date
    Jun 2005
    Location
    Belarus
    Posts
    25,689
    Liked
    157 times
    Add another rewrite condition:
    Code:
    RewriteCond %{THE_REQUEST} !admincp/
    Oleg Ignatiuk / Crawlability Inc.
    vBSEO 3.6.0 GOLD Released!
    Unveiling the NEW vBSEO Sitemap Generator 3.0. - available NOW for vBSEO Customers!


  15. #15
    Senior Member
    Real Name
    Matthew
    Join Date
    Nov 2006
    Posts
    127
    Liked
    0 times
    Thanks again.

    Realised this is in the wrong forum too, so please feel free to move.

Similar Threads

  1. vBadvanced index.php rewrite?
    By Phooey in forum Custom Rewrite Rules
    Replies: 2
    Last Post: 03-02-2007, 11:28 AM
  2. Rewrite vBa static folders and pages
    By eJM in forum Custom Rewrite Rules
    Replies: 3
    Last Post: 11-17-2006, 07:47 PM
  3. vBSEO 2.0 RC7 Released
    By Juan Muriente in forum vBSEO Announcements
    Replies: 17
    Last Post: 09-09-2005, 12:00 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •