Not signed in (Sign In)

Vanilla 1.1.10 is a product of Lussumo. More Information: Documentation, Community Support.

    • CommentAuthordime
    • CommentTimeMar 6th 2009 edited
     
    Note: I'll split this post since it is a little longer

    I'm using Plogger for several years and have established one big site on it which had good ranking in search engines. Version I use is 3.0 Beta released by Mike in July of 2007, which I slightly modified for my needs.

    For all this time site was hosted on same hosting company, and PHP version was some 4.x (I think that it was 4.4.x more precisely). Several days ago day, hosting company moved my (and all accounts on that server) to new cluster which has PHP 5.2.42. I was offline (in real life, not website :)) at that time and when I was back I first didn't notice any problem, but after that I saw that there are some for me really serious problems. I don't know is reason for this that server upgrade, but I'm sure that any file on server wasn't changed either by me or somebody other.

    First to explain how I use Plogger. It is stored in in directory /index.php (yes, I made mistake several years ago while naming it, but it worked without problem till now), so that url is example.com/index.php/ , and I use only one collection where all albums are located (so urls of albums are like example.com/index.php/collection/albumname).

    I don't use classic Plogger hierarchy but instead on home page (example.com, index file named default.php) I place links that point directly to albums, so visitors don't go to collections' pages. I use cruft-free urls and made changes in .htaccess so that I could redirect no-www visits to www domain, as per suggestion from here.

    So what is problem now? Problem is that now after I visit example.com I get 301 (moved permanently) redirection to example.com/index.php/ (so it skip home page and goes directly to Plogger).

    Second problem is that now there aren't cruft-free urls, there are now default dynamic urls (so I get i.e. example.com/index.php/?level=collection&id=3 ). What is interesting is that after I enter manually cruft-free url (i.e. example.com/index.php/collection/albumname) I get that album page but now links that point to pictures' pages are combination of cruft-free and dynamic one (i.e. example.com/index.php/collection/albumname?level=picture&id=1279) and after you click on that url you don't get picture page, but instead collection page (you know that this version of Plogger doesn't produce 404 errors) and on that collection pages links to albums are again in that form (i.e. example.com/index.php/collection/albumname?level=album&id=4 and that is infinitely).

    Third problem is that titles are not generated at all. No matter what type of URL is used or what type of page (album, picture, search etc) there is no title in <head> (note that this doesn't mean that there is <title></title>, there is no <title> tag at all)
    • CommentAuthordime
    • CommentTimeMar 6th 2009
     
    This is all I saw for now and here are codes.

    In root there is .htaccess with following code:


    <IfModule mod_rewrite.c>
    Options +FollowSymlinks
    RewriteEngine on

    RewriteBase /index.php/index.php
    RewriteCond %{REQUEST_FILENAME} -d [OR]
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule ^.*$ - [S=2]
    RewriteRule /index.php/feed/$ plog-rss.php?path=%{REQUEST_URI} [L]
    RewriteRule ^.*$ index.php/index.php?path=%{REQUEST_URI} [L]

    # 301-redirects all example.tld/* requests to www.example.tld/*:

    RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
    RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]

    Options -Indexes
    </IfModule>


    In /index.php directory there is .htaccess with following code:

    # BEGIN Plogger

    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
    RewriteRule .* http://www.example.com%{REQUEST_URI} [R=301,L]
    RewriteBase /index.php
    RewriteCond %{REQUEST_FILENAME} -d [OR]
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule ^.*$ - [S=2]
    RewriteRule feed/$ plog-rss.php?path=%{REQUEST_URI} [L]
    RewriteRule ^.*$ index.php?path=%{REQUEST_URI} [L]
    </IfModule>
    # END Plogger


    In plog-functions.php I used modified code for titles (I already wrote about this):

    function generate_title(){
    switch ($GLOBALS['plogger_level']) {
    case 'collection':
    $row = get_collection_by_id($GLOBALS['plogger_id']);

    $breadcrumbs = SmartStripSlashes($row["name"]);
    if ($GLOBALS['plogger_mode'] == "slideshow") $breadcrumbs .= ' &raquo; Slideshow';

    break;
    case 'slideshow':
    case 'album':
    $row = get_album_by_id($GLOBALS['plogger_id']);
    $album_name = SmartStripSlashes($row["name"]);

    $row = get_collection_by_id($row["parent_id"]);

    if ($GLOBALS['plogger_mode'] == "slideshow") {
    $breadcrumbs = SmartStripSlashes($row["name"]) . ' &raquo; ' . $album_name.' &raquo; ' . ' Slideshow';
    } else {
    $breadcrumbs = $album_name;
    }

    break;
    case 'picture':
    $row = get_picture_by_id($GLOBALS['plogger_id']);
    $picture_name = basename($row["path"]);

    $row = get_album_by_id($row["parent_album"]);
    $album_name = SmartStripSlashes($row["name"]);

    $row = get_collection_by_id($row["parent_id"]);

    $collection_name = SmartStripSlashes($row["name"]);

    $breadcrumbs = $album_name . ' &raquo; ' . $picture_name . ' | ' . SmartStripSlashes($config["gallery_name"]);

    if ($GLOBALS['plogger_mode'] == "slideshow") $breadcrumbs .= ' &raquo; Slideshow';

    break;
    default:
    $breadcrumbs = ' Collections';
    }

    return $breadcrumbs;
    }


    Also in function plogger_head there is this code for title:

    $title = generate_title_in_head($GLOBALS['plogger_level'], $GLOBALS['plogger_id']);


    if ($config["embedded"] == 0) {
    print "<title>$title</title>\n";
    }




    I gave as much information as possible. If you need more information for this I'll give you. If you have no time for quicker then usual help on forum I'm willing to pay for faster help, since I don't want to search engines index this changed gallery.

    Thanks in advance
    •  
      CommentAuthorsidtheduck
    • CommentTimeMar 6th 2009
     
    dime,

    So basically, dime, most of the issues are arising from Plogger thinking that it's embedded (when it is not). The title issue and the cruft-free URL issue are stemming from that. I'm guessing that when your webhost upgraded their system, either PATH_TRANSLATED is not set correctly or it is blank and is causing the issue (beta3 relied on PATH_TRANSLATED only to attempt automatic detection of embedding). To fix, open plog-load_config.php and find the following code:
    $config["embedded"] = 0;

    // try to figure out whether we are embedded (for example running from Wordpress)
    // on windows/apache $_SERVER['PATH_TRANSLATED'] uses "/" for directory separators,
    // __FILE__ has them the other way, realpath takes care of that.
    if (dirname(__FILE__) != dirname(realpath($_SERVER["PATH_TRANSLATED"])) && strpos($_SERVER["PATH_TRANSLATED"],"admin") === false) {
    $config["embedded"] = 1;
    // disable our own cruft-free urls, because the URL has already been processed
    // by WordPress
    $config["use_mod_rewrite"] = 0;
    } else {
    $config["baseurl"] = "http://".$_SERVER["HTTP_HOST"]. substr($_SERVER["PHP_SELF"],0,strrpos($_SERVER["PHP_SELF"],"/")) . "/";
    }

    and change it to read:
    $config["embedded"] = 0;

    // try to figure out whether we are embedded (for example running from Wordpress)
    // on windows/apache $_SERVER['PATH_TRANSLATED'] uses "/" for directory separators,
    // __FILE__ has them the other way, realpath takes care of that.
    //if (dirname(__FILE__) != dirname(realpath($_SERVER["PATH_TRANSLATED"])) && strpos($_SERVER["PATH_TRANSLATED"],"admin") === false) {
    // $config["embedded"] = 1;
    // // disable our own cruft-free urls, because the URL has already been processed
    // // by WordPress
    // $config["use_mod_rewrite"] = 0;
    //} else {
    $config["baseurl"] = "http://".$_SERVER["HTTP_HOST"]. substr($_SERVER["PHP_SELF"],0,strrpos($_SERVER["PHP_SELF"],"/")) . "/";
    //}

    Please note that we have changed the code for the next release to use a couple of different ways to determine if Plogger is embedded as well as a simple way to override the checks, so you should be good for future upgrades.

    For the 301 redirect issue you are having, I'm not sure exactly what changed without seeing the specific file structure on your site (if you would like, you can email me temporary FTP information to your site to sidtheduck SPLAT gmail DOT com and I'll take a look at your specific example, then you can delete the FTP account when I am done). I'm guessing they changed how their indexes are checked (I've seen the order as: index.html, index.php, default.html, default.php, etc.) or actually, they may have just limited it to index.html or index.php (it's not even looking for default.php, but looking for index.php or index.html. If you either of those files do not exist on your site, your root .htaccess rules are 301 redirecting to the main Plogger page). I would attempt to rename 'default.php' to 'index.php' on your site or talk to your webhost about adding 'default.php' the the beginning of your DirectoryIndex directive in httpd.conf on *nix machines or the ?Enable Default Document? option of IIS (windows) server.

    However, I think you should change the order of your root .htaccess file rules as well. You currently have (from your post above):
    <IfModule mod_rewrite.c>
    Options +FollowSymlinks
    RewriteEngine on

    RewriteBase /index.php/index.php
    RewriteCond %{REQUEST_FILENAME} -d [OR]
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule ^.*$ - [S=2]
    RewriteRule /index.php/feed/$ plog-rss.php?path=%{REQUEST_URI} [L]
    RewriteRule ^.*$ index.php/index.php?path=%{REQUEST_URI} [L]

    # 301-redirects all example.tld/* requests to www.example.tld/*:

    RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
    RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]

    Options -Indexes
    </IfModule>

    and I would try this to make sure your www's are working correctly every time:
    <IfModule mod_rewrite.c>
    Options +FollowSymlinks
    RewriteEngine on

    RewriteBase /index.php/index.php
    # 301-redirects all example.tld/* requests to www.example.tld/*:
    RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
    RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
    # Other Plogger rewriterules
    RewriteCond %{REQUEST_FILENAME} -d [OR]
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule ^.*$ - [S=2]
    RewriteRule /index.php/feed/$ plog-rss.php?path=%{REQUEST_URI} [L]
    RewriteRule ^.*$ index.php/index.php?path=%{REQUEST_URI} [L]

    Options -Indexes
    </IfModule>


    Hope that helps. :D
    • CommentAuthordime
    • CommentTimeMar 6th 2009
     
    Thank you a lot Sid! You were right for both things. I replaced code in plog-load_config.php and URLs and titles started to work normally.

    For redirection: I couldn't use index.php for file name (thats why I used default.php from before) but if I put index.html then index.html is loaded, not /index.php . So for now I'll use index.html as index file.

    I asked my host about this and they said that it is because of redirection in .htaccess, which is not true, this happened even if I removed completely this file. After that I asked them about change in httpd.conf but I still didn't get reply, and if they answer me they'll probably refuse it.

    Is there any workaround in .htaccess or something so that I use some php file as index?
    •  
      CommentAuthorsidtheduck
    • CommentTimeMar 6th 2009
     
    You could attempt to set your own DirectoryIndex in your .htaccess file like this:
    # Attempt to set your own DirectoryIndex:
    DirectoryIndex default.php index.html index.php

    <IfModule mod_rewrite.c>
    Options +FollowSymlinks
    RewriteEngine on

    RewriteBase /index.php/index.php
    # 301-redirects all example.tld/* requests to www.example.tld/*:
    RewriteCond %{HTTP_HOST} ^example\.com$ [NC]
    RewriteRule ^(.*)$ http://www.example.com/$1 [R=301,L]
    # Other Plogger rewriterules
    RewriteCond %{REQUEST_FILENAME} -d [OR]
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule ^.*$ - [S=2]
    RewriteRule /index.php/feed/$ plog-rss.php?path=%{REQUEST_URI} [L]
    RewriteRule ^.*$ index.php/index.php?path=%{REQUEST_URI} [L]

    Options -Indexes
    </IfModule>
    • CommentAuthordime
    • CommentTimeMar 8th 2009
     
    After you replied I got reply from support and they said that I could edit this in .htaccess using same code as one you provided, so this is fixed now.

    Thanks a lot Sid!