Announcement

Collapse
No announcement yet.

How to fix the Archive problem on PHP-CGI installations

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • How to fix the Archive problem on PHP-CGI installations

    After moving to my new dedicated web server, I was having problems viewing the Archive. When you'd click on Archive, it would simply redirect you back to the forum home page. This also means that search engines are probably not crawling your site very much, as the archive feature was designed to consolidate the posts on your forum into a search engine friendly format.

    After doing some research I discovered that this was due to the fact that PHP is running under CGI on my server instead of as a module. Further research and piecing together info from other posts, I ended up with the following fix, which works GREAT on my forum. Thanks to Martin at vBulletin -Germany for the hack, and Scott MacVicar for the index.php bugfix.

    As always, backup your files first, and make changes at your own risk! This fix only applies to: vBulletin 3.0.1

    ##########################
    # /archive/index.php find this: #
    ##########################
    PHP Code:
    if (strpos($_SERVER['PHP_SELF'] , '/archive/index.php/') === false)
    {
    exec_header_redirect("$vboptions[bburl]/archive/index.php/");

    ####################
    # -> Replace with this #
    ####################
    PHP Code:
    $endbit '';
    if (isset(
    $_GET['a']))
    {
    $endbit preg_replace('#[^[:alnum:]-]#'''trim($_GET['a']));

    ##########################
    # /archive/index.php find this: #
    ##########################
    PHP Code:
    $foruminfo fetch_foruminfo($f); 
    ####################
    # -> Replace with this: #
    ####################
    PHP Code:
    $foruminfo fetch_foruminfo($ffalse); 
    ##########################################
    # /archive/index.php - Comment out or remove this line: #
    #########################################
    PHP Code:
    $endbit str_replace('.html'''substr(strrchr($_SERVER['PHP_SELF'], '/') , 1)); 
    ##########################
    # /archive/global.php find this #
    ##########################
    PHP Code:
    if ((!empty($servertoobusy) AND $bbuserinfo['usergroupid'] != 6) OR $vboptions['archiveenabled'] == OR strpos(SAPI_NAME'apache') === false
    ####################
    # -> Replace with this: #
    ####################
    PHP Code:
    if ((!empty($servertoobusy) AND $bbuserinfo['usergroupid'] != 6) OR $vboptions['archiveenabled'] == 0
    Now, create a .htaccess file and place this file in the /archive/ directory. The .htaccess file should contain the following:

    RewriteEngine on
    RewriteBase /XXXX/archive/
    RewriteRule ^(f-|t-)+([0-9]+)?(-p-[0-9]+)? index.php?a=$1$2$3


    Be sure to replace XXXX with the directory for your forum.

    Good Luck!!
    J.R. Rogers

  • #2
    I might incorporate a switch in to 3.0.2 so you dont need to add all of the above and just apply the re-write.
    Scott MacVicar

    My Blog | Twitter

    Comment


    • #3
      Originally posted by Scott MacVicar
      I might incorporate a switch in to 3.0.2 so you dont need to add all of the above and just apply the re-write.
      That's a good idea, because it seems that a lot of hosting providers are running PHP under CGI instead of as a module under Apache. Anyone know why they do this? Performance? Security?

      JR

      Comment


      • #4
        Originally posted by Scott MacVicar
        I might incorporate a switch in to 3.0.2 so you dont need to add all of the above and just apply the re-write.
        Please, please, do that.
        Harold Kost

        Comment


        • #5
          Originally posted by J.R. Rogers
          That's a good idea, because it seems that a lot of hosting providers are running PHP under CGI instead of as a module under Apache. Anyone know why they do this? Performance? Security?

          JR
          stupidity?

          When i inform most hosts they change it straight away. Though some do use it so they can see who is hogging resources but it decreases performance cause a seperate cgi process is invoked everytime PHP is used.
          Scott MacVicar

          My Blog | Twitter

          Comment


          • #6
            My apache is installed as a cgi on my server/host.

            With nothing edited the archive does not work BUT the archive does work INSIDE of admincp... you know where in admincp where you can turn search engine friendly archive ON or OFF and you can click "search engine freindly archive" and you goto the archive/index.php INSIDE admincp... it works there.

            Now... when I made the above chances... nothing happens and now inside admincp the archive doesn't work.


            does anyone follow me here?...

            Comment


            • #7
              Super!!! Thanks a lot. It works !

              Comment


              • #8
                Thanks, JR. It works great!
                Harold Kost

                Comment


                • #9
                  archive problem

                  I have the exact same problem as JR. Identical scenerio. I followed the instruction provided and finally I was able to get the archive working where it showed all the categories and forums. I was soooo excited! may be not. I can view the main board categories and forums listed. I can even see the topics listed under forum. But when I click on an individual topic to see the posts or to see what users have posted, I get a blank page! I dont see anything! What am I doing wrong? or what am I missing? anyone , please help!

                  Thank you

                  Comment


                  • #10
                    thank you so much

                    Comment


                    • #11
                      Works Pefect!

                      Beautiful, works perfect and only took me 15 minutes! And I'm a novice!

                      Thanks a Bunch.

                      No more google worries!

                      Comment


                      • #12
                        Originally posted by new2vb
                        I have the exact same problem as JR. Identical scenerio. I followed the instruction provided and finally I was able to get the archive working where it showed all the categories and forums. I was soooo excited! may be not. I can view the main board categories and forums listed. I can even see the topics listed under forum. But when I click on an individual topic to see the posts or to see what users have posted, I get a blank page! I dont see anything! What am I doing wrong? or what am I missing? anyone , please help!

                        Thank you
                        did u forget this part?

                        Originally posted by J.R. Rogers
                        Now, create a .htaccess file and place this file in the /archive/ directory. The .htaccess file should contain the following:

                        RewriteEngine on
                        RewriteBase /XXXX/archive/
                        RewriteRule ^(f-|t-)+([0-9]+)?(-p-[0-9]+)? index.php?a=$1$2$3


                        Be sure to replace XXXX with the directory for your forum.

                        Good Luck!!
                        J.R. Rogers
                        thanks J.R Rogers, it worked like a charm
                        http://www.la-kopi.com/images/affiliates/kopi1.gif
                        www.la-kopi.com

                        Comment


                        • #13
                          Actually

                          cgi.fix_pathinfo = 1

                          in your php.ini should fix it as well, thats without the mod_rewrite stuff.
                          Scott MacVicar

                          My Blog | Twitter

                          Comment


                          • #14
                            Worked for me even though my server isn't running PHP as CGI. Thanks!
                            Richard Young, Esq.
                            asian forums | asians
                            Reverse Funnel System - Fastest Way To Monetize Your Forum

                            Comment


                            • #15
                              OMG been looking everywhere for this, works perfectly thanks for your post!!!!b

                              Comment

                              widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
                              Working...
                              X