Not signed in (Sign In)

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

  1.  
    All rewritten urls should have a trailing slash added to the end of them. It's good practice as Google doesn't see it as a folder if it doesn't have a trailing slash.

    Anyone know how to do this?
    • CommentAuthordime
    • CommentTimeAug 11th 2007
     
    I try do maximally optimize my site for search engines in things I know, but I didn't take much care about problem of trailing slash. So I researched on this topic and found some interesting and useful articles. First is use of trailing slashes on Apache servers, and there are this links I want to share.

    http://httpd.apache.org/docs/2.0/misc/rewriteguide.html#url
    http://www.goldmark.org/jeff/cranfield/www/may14-1998/jeff10.html
    http://kimihia.org.nz/articles/trailing/
    http://www.alistapart.com/articles/slashforward/
    http://www.isitebuild.com/301-redirect.htm

    Secondly there are questions about seo and trailing slashes and links are:

    http://www.ragepank.com/articles/68/that-trailing-slash-does-matter/
    http://www.seroundtable.com/archives/001327.html
    http://www.standardzilla.com/2007/07/09/dont-forget-your-trailing-slash/
    http://www.johnon.com/267/trailing-slash-seo.html

    I just want to note that this are just some of things I read. After all this I think that on this type of sites it's better to use urls ending with slashes; for some other, like Wikipedia, there is no need for them. Before anyone start using slashes on Plogger, I must ask authors is there some reason why there is no slash on the end or no?

    To add slash at the end of url, I found that it can be done in plog-function.php in function generate_url. Just replace line
    $rv = $config["baseurl"].rawurlencode($row["path"]);
    with
    $rv = $config["baseurl"].rawurlencode($row["path"]) . '/';
    and
    $rv = $config["baseurl"].rawurlencode($row["collection_path"]) . '/' . rawurlencode($row["album_path"]);
    with
    $rv = $config["baseurl"].rawurlencode($row["collection_path"]) . '/' . rawurlencode($row["album_path"]) . '/';
    Problem with this that then there are two slashes in slideshow urls, for example /collection/album//slideshow, and I didn't find way to remove it.

    Also, I noticed one problem with default configuration: when there is more than one page, if you are on page 2 or above, link to first page will be album/?page=1 and not default one, so we have duplicated content problem for search engines.
    •  
      CommentAuthorsidtheduck
    • CommentTimeJun 5th 2008
     
    i don't know if people are still wanting this, but I agree with dime, so I added it to the SVN trunk (revision 546 + 547). It adds a trailing slash to all Cruft-Free URLs and removes the double slash for slideshow, search, and pagination.

    I still need to add the code to make pagination cruft-free too and I've started a bug ticket regarding this issue. I'll get to it as soon as I can.
    • CommentAuthortreebonker
    • CommentTimeJun 10th 2008
     
    Along with Cruft-Free URLs is there a way(or have plans) to 301 redirect links with no end slash to end slash and non-www to www like the Wordpress permalink-redirects plugin? The only way I can avoid duped contents is to turn off Cruft-Free URLs so the root .htaccess can redirect non-www to www for the gallery dir and subdir's.
    •  
      CommentAuthorsidtheduck
    • CommentTimeJun 10th 2008
     
    treebonker,

    I've integrated this into my own code via the .htaccess RewriteRules, but it caused some changes within the 'plog-options.php' and 'plog-admin-functions.php' files. I'll try to update the SVN with the new code.

    In the meantime, you can manually edit your own .htaccess file within Plogger to read as follows:# BEGIN Plogger

    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteBase /your_plogger_folder_here
    RewriteCond %{HTTP_HOST} !^www [NC]
    RewriteRule ^(.*)$ http://www.your_site.com/your_plogger_folder_here/$1 [R=301,L]
    RewriteCond %{REQUEST_FILENAME} -d [OR]
    RewriteCond %{REQUEST_FILENAME} -f
    RewriteRule ^.*$ - [S=4]
    RewriteCond %{REQUEST_URI} !(\.|/$)
    RewriteRule ^(.*)$ $1/ [R=301,L]
    RewriteRule feed/$ plog-rss.php?path=%{REQUEST_URI} [L]
    RewriteRule ^.*$ index.php?path=%{REQUEST_URI} [L]
    </IfModule>
    # END Plogger
    Just replace 'www.your_site.com' and 'your_plogger_folder_here' with your actual values. That should force a 301 redirect for non-trailing slashes and non www. request.

    Let me know if it works for you! :D
    • CommentAuthortreebonker
    • CommentTimeJun 11th 2008 edited
     
    Works great, thank you! Fixed the mod_rewrite and the double slashed ..//feed/ link issue associated with the permanent redirect. One question though, when requesting http://www.domain.com/plogger it redirects to http://domain.com/plogger/ and then http://www.domain.com/plogger/. I'm not sure why it strips the www when adding the trailing slash. Is there a way around this?
    •  
      CommentAuthorsidtheduck
    • CommentTimeJun 11th 2008
     
    Posted By: treebonkerWorks great, thank you! Fixed the mod_rewrite and the double slashed ..//feed/ link issue associated with the permanent redirect. One question though, when requesting http://www.domain.com/plogger it redirects to http://domain.com/plogger/ and then http://www.domain.com/plogger/. I'm not sure why it strips the www when adding the trailing slash. Is there a way around this?
    I'm guessing the reason it strips the 'www' is because your server is set up with 'www' as a CNAME for the top level domain. In this instance, our mod_rewrite rules are not adding the trailing slash, your server setup is. This is because the folder "plogger/" is an actual directory on the server (which skips our trailing slash setup).

    So the way I see it redirecting on your server is thus:

    • The trailing slash is left off ( http://www.domain.com/plogger ) and the server setup (or other top level mod_rewrite) is adding the trailing slash for the real directory "plogger/", but redirecting it to the top level domain without the 'www' CNAME added ( http://domain.com/plogger/ ).

    • The redirection without the 'www' is being caught by our new mod_rewrite code and redirecting with the 'www' added ( http://www.domain.com/plogger/ ).



    Below, I'll comment on my understanding of the mod_rewrite code:# BEGIN Plogger

    # Start of the IF statement
    # If the module 'mod_rewrite' is available on the server, do the following code (down to the closing </IfModule> tag)
    <IfModule mod_rewrite.c>

    # Turn on the RewriteEngine
    RewriteEngine on

    # This rule only applies to files / folders that are located under the directory 'your_plogger_folder_here'
    RewriteBase /your_plogger_folder_here

    # If the HTTP_HOST is returned without a 'www' at the beginning . . .
    RewriteCond %{HTTP_HOST} !^www [NC]
    # . . . , then redirect (permanently using a '301' redirect) with the 'www' included
    RewriteRule ^(.*)$ http://www.your_site.com/your_plogger_folder_here/$1 [R=301,L]

    # If the REQUEST_FILENAME is a real directory . . .
    RewriteCond %{REQUEST_FILENAME} -d [OR]
    # . . . or if REQUEST_FILENAME is a real filename . . .
    RewriteCond %{REQUEST_FILENAME} -f
    # . . . , do nothing and skip the next 4 lines of code (the ReweriteCond and 3 RewriteRules)
    RewriteRule ^.*$ - [S=4]

    # If the REQUEST_URI does not contain a dot (.) as in a file extension (.php or .html) OR if it does not end with a trailing slash . . .
    RewriteCond %{REQUEST_URI} !(\.|/$)
    # . . . , then redirect (permanently using a '301' redirect) with a trailing slash added (/)
    RewriteRule ^(.*)$ $1/ [R=301,L]

    # any path that ends with "feed/" gets invisibly redirected to "plog-rss.php?path=" where "path" is equal to everything to the right of "your_plogger_folder_here/"
    RewriteRule feed/$ plog-rss.php?path=%{REQUEST_URI} [L]

    # any other path gets invisibly redirected to "index.php?path=" where "path" is equal to everything to the right of "your_plogger_folder_here/"
    RewriteRule ^.*$ index.php?path=%{REQUEST_URI} [L]

    # END of the IF statement
    </IfModule>
    # END Plogger
    • CommentAuthortreebonker
    • CommentTimeJun 12th 2008 edited
     
    You're right. Requesting non-www without a trialing slash it would go through 3 redirects adding www then adds the slash while removing www and then adding www again.

    I got rid of the multiple redirects by moving the trailing slash code out of the skip code and changing the RewriteRule so that any request without a trailing slash and/or www is redirected to www with slash in a single redirect. I had to replace the backtrace with REQUEST_URI as it would display the servers local path eg)www.domain.com//home/user/user_name/www/plogger/.

    /# Begin Plogger

    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteBase /your_plogger_folder_here
    RewriteCond %{REQUEST_URI} !(\.|/$)
    RewriteRule ^(.*)$ http://www.your_site.com%{REQUEST_URI}/ [R=301,L]
    RewriteCond %{HTTP_HOST} !^www [NC]
    RewriteRule ^(.*)$ http://www.your_site.com/your_plogger_folder_here/$1 [R=301,L]
    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

    Thank you again. All is good...for now! :D
    •  
      CommentAuthorsidtheduck
    • CommentTimeJun 12th 2008
     
    Nice! I had played with using the above mod_rewrite to add the trailing slash to all instances (even real directories), but I didn't check to see if it cleared up the multiple redirects better than letting it default as it was. Thanks for testing and sharing your findings with the forums!
    • CommentAuthorPieperLy
    • CommentTimeAug 24th 2008
     
    hello,

    i use beta3 and added the ... . '/' and change the .htaccess to sidtheducks (without www option) version. now i have the equal problem with doubleslashes on slideshow-link and pagination-links.
    without . '/' breadcrumblinks and thumblinks shows wrong url, without a trailing slash, only rewrite rule on .htaccess rewrite the url to trailing slash.
    how can i correct this?
    (SVN trunk isn't an alternative for me - after install svn shows many, many errors on my site so i canceled the svn and use beta3)
    give it a solution for the problem with pagination /?page=1 equal to / ?
    rebonkers .htaccess give back a servererror 500
    thanks for spend your time
    reagards from germany
    uwe
    •  
      CommentAuthorsidtheduck
    • CommentTimeAug 25th 2008 edited
     
    Posted By: PieperLy(SVN trunk isn't an alternative for me - after install svn shows many, many errors on my site so i canceled the svn and use beta3)
    What errors show up when you use the SVN installation? The reason I ask is that it shouldn't have any errors and also, to accomplish what you want with the trailing slashes is a lot of code changes (which have been implemented in a couple of SVN commits).
    • CommentAuthorPieperLy
    • CommentTimeAug 25th 2008
     
    hello,

    that i can't say: i get a shock after install svn, i think: o god... so i'am instantly reinstall beta3. my site is already online for a while (with beta2), and i can't risk, that they don't work. sorry, i know, that errormessages are important but the most important for me, was my site.
    i update to beat3 only for more seo-options, but now i see, that seo not yet full built in.

    hope you understand me!
    reagards from germany
    uwe
    •  
      CommentAuthorsidtheduck
    • CommentTimeAug 26th 2008
     
    I'm guessing that is was just throwing notices and warnings from something else on your site (I noticed this too when integrated with some Wordpress plugins). If you wanted to try installing it again, just change error_reporting(E_ALL); to error_reporting(0); in plog-globals.php on line 10 before uploading and see if that works for you.
    • CommentAuthorPieperLy
    • CommentTimeAug 27th 2008
     
    hm, i can try repeat the svn installation...any questions to it:

    1: how can i use in svn the old beta2 format /?page=x for albums instead the new /?plog_page=x

    2: how can i change the gallery-root from / to the old format /index.php?

    3: can i these two options change before i install svn?

    4: gives in svn the correct trailing slash for all breadcrumb- and thumblinks and adresses?

    5: can i set picture-site extensions in svn to .html or .php or /

    6: to upgrade can i copy the svn-files over the plogger3 files and then run _upgrade.php?

    7: wich svn is the last and where can i download this?

    8: can i use in svn filenames under thumbs in picture.php with truncate option?

    9: can i dissable the javascript-mouseover-gimmick for comments? the art to show from beta2 (3 comments) was beautiful.

    sorry for my questions, but i'am anxious - that's for the first ;-)

    cordial greetings from germany
    uwe
    ps: thanks for your nice script. i used already beta2 for a longer time.
    •  
      CommentAuthorsidtheduck
    • CommentTimeAug 27th 2008 edited
     
    PieperLy,

    I'm assuming you will be using the cruft-free URL approach as you are looking for SEO optimization. My answers below are based upon that assumption.

    Posted By: PieperLy1: how can i use in svn the old beta2 format /?page=x for albums instead the new /?plog_page=x
    When using cruft-free URLs, pagination is now no longer being used as ?page=x at all. It's now rendered as /page/x/ It was changed from ?page=x to plog_page=x because there are other CMS instances out there that use ?page=x for switching pages. There are also ones that use ?id=x and we are working on changing Plogger from ?id=x to ?plog_id=x or something of the sort.

    Posted By: PieperLy2: how can i change the gallery-root from / to the old format /index.php?
    The current SVN trunk uses the base that you start with, so if you start your page from http://www.mysite.com/index.php it will continue the links with http://www.mysite.com/index.php?level=collection&id=x, but if you are using http://www.mysite.com/ it will continue with http://www.mysite.com/?level=collection&id=x. If you are using cruft-free URLs, it removes the 'index.php' autmatically so you get URLs like http://www.mysite.com/collection/album/ (clean)

    Posted By: PieperLy3: can i these two options change before i install svn?
    See above.

    Posted By: PieperLy4: gives in svn the correct trailing slash for all breadcrumb- and thumblinks and adresses?
    Yep, all are done with a trailing slash.

    Posted By: PieperLy5: can i set picture-site extensions in svn to .html or .php or /
    The current SVN removes the file extension and adds a trailing slash. It used to be /collection/album/picture.jpg and now it's /collection/album/picture/

    Posted By: PieperLy6: to upgrade can i copy the svn-files over the plogger3 files and then run _upgrade.php?
    We are still working on the installation/upgrade code for the new SVN trunk > revision 550 when the structure was altered. Basically, the easiest way at this point is:
    Step 1. Upgrade to Beta3 by uploading the Beta3 files and running _upgrade.php (will upgrade the database)
    Step 2. Delete everything except: plog-config.php, /images/, /thumbs/, /plog-translations/, /themes/, and /uploads/
    Step 3. Upload the new SVN code to your site.
    Step 4. Move /images/, /thumbs/, /plog-translations/, /themes/, and /uploads/ to the new /plog-contents/ folder. Rename /plog-contents/plog-translations/ to /plog-contents/translations/.

    Posted By: PieperLy7: wich svn is the last and where can i download this?
    The latest is revision 572. The link is here

    Posted By: PieperLy8: can i use in svn filenames under thumbs in picture.php with truncate option?
    You'll have to copy your plogger_get_filename() function. I haven't yet added it to the SVN (but I could soon if you want to wait).

    Posted By: PieperLy9: can i dissable the javascript-mouseover-gimmick for comments? the art to show from beta2 (3 comments) was beautiful.
    I'm not sure I know what you are talking about. Is this the overlay from the default theme that shows the number of comments if you mouse-over the image? You can always use a different theme or change the default one to do what you would like. If you can wait for about a day, I can finish uploading some code I've been working on that should allow you to use your old theme for the current install of Plogger.

    I would recommend creating a backup of your installation and database just in case something goes wonky if you are updating this directly on your site. There may be some bugs with the SVN code too, but it should be fairly stable. Let us know if you run into any issues. If this seems like too big of a deal at the moment, you might want to wait for the next release which should be coming out soon.
    • CommentAuthorPieperLy
    • CommentTimeAug 28th 2008
     
    hello sidtheduck,

    thanks for your big answer. yes, seo optimization is what i want. without seo is today a "no go" for websites. my handycap is the history of my site:
    i have /index.htm as startsite on my web and /index.php as gallery start - both on root. browser are looking first to index.html - up to now without problems.
    when now i move the gallery-root from /index.php to / then lose many links to /index.php and lose my welcome-startpage.

    when i make a dir under / e.g. /bilder/ then i lose all links to gallery, but i can keep my startpage on /index.html



    the right decision is complicated ;-)

    still one question:
    what is with page-description from dirs /collection/album/page/x/ - can i use a different descriptins and titles for all .../x/ pages, or is it's the same for
    /collection/album/page/1/
    /collection/album/page/2/
    /collection/album/page/3/
    /collection/album/page/4/

    otherwise i have the old double title and description problem.

    and last question (for the first;-)):
    how can i change the charset from utf-8 to iso iso-8859-1 in svn?

    on weekend i change from beta3 to svn.

    i become create a new dir/bilder/
    on /index.php in root i built 301 forwarding code:

    <?
    Header("Location: http://www.xxx.de/bilder/");
    Header("Status: 301");
    exit();
    ?>

    i send you a feedback, when it's done

    cordial greetings from germany
    uwe
    ps: thanks for spend your time, i esteem this.
    •  
      CommentAuthorsidtheduck
    • CommentTimeAug 28th 2008
     
    PieperLy,

    I think you have the right idea with the 301 redirects. That seems awkward to me to have an index.html AND and index.php in the same file (but maybe that's just me ;) ).

    Regarding the descriptions and titles for different pages, currently it is not set up (although it does have a ticket and is being worked on).

    Regarding my post above with your plogger_get_filename() and using old themes, I committed the code this morning (revision 573). The link above should still link to the current version of the SVN trunk so you should be all ready to go for an install this weekend (good luck! :D).

    Let us know if you run into anything.
    • CommentAuthorPieperLy
    • CommentTimeAug 28th 2008 edited
     
    good morning, sidtheduck,

    thanks for your nightly work - prime, that you have done the new revision.
    (your link above to svn 573 is broken - can you rectify?)

    ...

    index.html and index.php are not the same file, they are in same dir. first, i install plogger (with /index.php) and ca. a half year later, i wan't to make a welcome page on my site (without lose my links), so i create a /index.html. simple solution and works good...up to now.

    have a nice day
    uwe
    •  
      CommentAuthorsidtheduck
    • CommentTimeAug 29th 2008 edited
     
    Posted By: PieperLy(your link above to svn 573 is broken - can you rectify?)
    It should be fixed now.

    Posted By: PieperLy
    index.html and index.php are not the same file, they are in same dir
    I understand you completely and why you would do something of the sort, I just think it is awkward. :)

    Posted By: PieperLy
    how can i change the charset from utf-8 to iso iso-8859-1 in svn?
    Why do you want to change from UTF-8? This will handle any foreign language support.
    • CommentAuthorPieperLy
    • CommentTimeAug 29th 2008
     
    with utf-8 i have many cryptical chars on my site, change i to iso-8859-1 it's ok.
    •  
      CommentAuthorsidtheduck
    • CommentTimeAug 29th 2008
     
    Posted By: PieperLywith utf-8 i have many cryptical chars on my site, change i to iso-8859-1 it's ok.
    Try this then. Open 'plog-load_config.php' (plog-load-config.php in the SVN) and change the following code:
    $config['charset'] = 'utf-8';
    to:
    $config['charset'] = 'iso-8859-1';

    I'm not sure that will fix it everywhere and/or if you will have any issues with existing descriptions or captions.