Typo3, RealURL and a real 404 error page

Mar 24th, 2009 | Posted by | Filed under Typo3

When you setup your Typo3 installation with realURL you may also want to add a more informative 404 error page. At a first look this doesn’t seems to be a problem. Just open your localconf.php and add these lines at the end of the file.


$TYPO3_CONF_VARS["FE"]["pageNotFound_handling"] = 'http://www.example.com/not-found-404.html';
$TYPO3_CONF_VARS["FE"]["pageNotFound_handling_statheader"] = 'HTTP/1.1 404 Not Found';

An other way is to use the Install Tool -> All Configuration and setting the fields.

Try typing a wrong URL and be happy to see your custom 404 error page.
But stop! There is a small problem. You are not able to see this problem now. But if you try to add a Google site verification you’ll have the problem. So why? This problem is, that Typo3 redirects to the error page. This means not a 404 error code but a 301 followed by 200 (you custom error page) is send. That’s bad!
OK! So we need another way to setup your custom 404 error page in Typo3. Luckily we can setup not only a custom page but also a custom script! That’s where we’ll start:


$TYPO3_CONF_VARS["FE"]["pageNotFound_handling"] = 'USER_FUNCTION:fileadmin/pageNotFoundHandling.php:user_pageNotFound->pageNotFound';

This will execute the script fileadmin/pageNotFoundHandling.php which contains these:


<?php
class user_pageNotFound {
    function pageNotFound($param,$ref) {
        print "<html>\n<head>\n<title>404 Not found</title>\n";
        print "<meta http-equiv="refresh" CONTENT="0;URL=/not-found.html">\n";
        print "</head>\n<body>\n";
        print "<!--
            Just a placeholder to reach the limit of a custom 404 page\n
            Just a placeholder to reach the limit of a custom 404 page\n
            Just a placeholder to reach the limit of a custom 404 page\n
            Just a placeholder to reach the limit of a custom 404 page\n
            Just a placeholder to reach the limit of a custom 404 page\n
            Just a placeholder to reach the limit of a custom 404 page\n
            Just a placeholder to reach the limit of a custom 404 page\n
            Just a placeholder to reach the limit of a custom 404 page\n
            Just a placeholder to reach the limit of a custom 404 page\n
            Just a placeholder to reach the limit of a custom 404 page\n
            Just a placeholder to reach the limit of a custom 404 page\n
            Just a placeholder to reach the limit of a custom 404 page\n
            Just a placeholder to reach the limit of a custom 404 page\n
            Just a placeholder to reach the limit of a custom 404 page\n
            Just a placeholder to reach the limit of a custom 404 page\n
            Just a placeholder to reach the limit of a custom 404 page\n
            Just a placeholder to reach the limit of a custom 404 page\n
            Just a placeholder to reach the limit of a custom 404 page\n
        -->";
        print "</body>\n</html>\n";
    }
}
?>

It’s important not to use the Header( "Location: .."); statement since this is exactly what Typo3 does per default. Only the refresh via the meta tag will work!
Don’t forget to change the path to your error page :-)

Tags:

Thunderbird with Enigmail on IMAP

Mar 19th, 2009 | Posted by | Filed under Mozilla/Thunderbird

If you are working on an IMAP Server and using Enigmail to crypt and decrypt mail you may encounter a problem with decoded attachments. OpenPGP is not able to decrypt the whole message since the attachment is loaded on demand. If you want to change this just set this settings in you mail client installation:

user_pref("mail.server.default.mime_parts_on_demand", false);

Tags:

Speed up Typo3 – Performance Tips

Dec 15th, 2008 | Posted by | Filed under Typo3

If your Tyop3 installation is a bit slow the following tips my help to speed up you site.

  • Use a php cache module
  • Adjust the caching parameter of you mysql Installation.
    For me these setting helps for a performance boost
    key_buffer = 32M
    table_cache = 128
    query_cache_size = 64M
    query_cache_type = 1
    log-bin
  • Try this Typo3 extension: nc_staticfilecache

Load outdated Firefox Add-ons

May 20th, 2008 | Posted by | Filed under Mozilla/Firefox

If you like to test the newest version of Firefox may some of you plugins will stop work. This is since they really don’t work with this version or the of the plugion author hasn’t tested it and released a new version. If you don’t like to wait to update the add-on you have some options:

  • Edit the .xpi file. XPI is just a simple zip files which contains the plugin. There you’ll find an install.rdf where the author entered the maxVersion of the browser. So just edit, save, repack, rename and reinstall will work
  • Disable compatibility completely. You just need to add some information via the about:config dialog, restart and all add-ons will load again
  • Use the Nightly Tester Tools. After you installed this plugin you are able to choose on which add-on you like to disable the compatibility check. Just go to the add-on manager and right click on you outdated plugin. There you find a new menu entry.
    For me this is the preferred method!
Tags:

Google Calendar Sync

Mar 14th, 2008 | Posted by | Filed under Google, Outlook

If you like to sync your local Outlook installation with your Google Calendar or vice a via, you would be happy with this little new program. Google Calendar Sync

Tags:

Thunderbird and default sorting of mails

Mar 14th, 2008 | Posted by | Filed under Mozilla/Thunderbird

Have you ever wounder how to change the default sorting of the Thunderbird mail client? For me the standard default sorting it’s very annoying since I prefer the newest mail first. But out of box the my mail client shows the oldest one first.
So I went out and searched for a solution. And expect what: I found one! :-)

Open your Options dialog and choose “Config Editor” of the Advanced/General Page. The “about:config” of Thunderbird will open. Into the filter field type “mailnews.default” and you’ll see the current default of mails and news. Fine, but what are all these silly values means?
sort_order:

  • 1 ascending
  • 2 descending

sort_type:

  • 17 byNone
  • 18 byDate
  • 19 bySubject
  • 20 byAuthor
  • 21 byId
  • 22 byThread
  • 23 byPriority
  • 24 byStatus
  • 25 bySize
  • 26 byFlagged
  • 27 byUnread
  • 28 byRecipient
  • 29 byLocation
  • 30 byTags
  • 31 byJunkStatus
  • 32 byAttachments
  • 33 byAccount
  • 34 byCustom

For me I’ve just changed the mailnews.default_sort_order to 2 and I was happy.

Is there any addon out there which does the job? Up to now I didn’t found any. May I go ahead a write one …. as soon as I’ll get some spare time. (A request of such an extension could speed this process…)

Do you want more information about this? Look here.

Tags:

Typo3 How to render RTE content of an extension

Feb 8th, 2008 | Posted by | Filed under Typo3

When writing your own Typo3 extension you may come to the day where you need to enter some free HTML content. This content may also include some links. No Problem so far. But if you save the stuff to the db Typo3 transforms the text. For example all a-Tags are written as <link XX>Test</link> and so on.
So when you like to render the text you need to revert the transformation. (At this point it doesn’t matter if you are using FlexForms or the traditional TCA configuration).
All you need to do is to call this method and everything goes fine:

$outputText=$this->pi_RTEcssText($dbtext);
Tags:

Typo3 Localize your own extensions

Dec 7th, 2007 | Posted by | Filed under Typo3

When you try to write your own front end (FE) extensions with Typo3 there are common pitfalls. First of all be sure you enabled your table to hold the information. (Can be done very easy via the kickstarter). Next be sure you don’t query do much information of your table. All you need are the row where “sys_language_uid=0″. Your translation is made via the getRecordOverlay ! This short code snippet may help you to resolve your problems:


  function readDBData( $table, $where )
  {
    $back = array();

    if ( $where!="" )
      $where.= " AND ";
    $where .= " deleted=0 AND hidden = 0 AND sys_language_uid=0";

    $res = $GLOBALS['TYPO3_DB']->exec_SELECTquery( '*', $table, $where );
    while ($row = $GLOBALS['TYPO3_DB']->sql_fetch_assoc($res))
    {
      if ($GLOBALS['TSFE']->sys_language_content)
      {
        $OLmode = ($this->sys_language_mode == 'strict'?'hideNonTranslated':'');
        $row = $GLOBALS['TSFE']->sys_page->getRecordOverlay( $table, $row, $GLOBALS['TSFE']->sys_language_content, $OLmode);
      }
      $back[] = $row;
    }

    return $back;
  }

PS: Keep in mind this tip, too: Web List: ‘Localize-to-feature’

Tags:

Force qmail to send queue mails – now!

Nov 30th, 2007 | Posted by | Filed under qmail

If you ever want to send you queued mails quickly you may try this command:


kill -ALRM `ps ax | grep qmail-send | grep -v grep | awk '{print $1}'`

To check the queue you can use this command:

qmail-qstat

Tags:

Typo3 RealURL and 404 file not found

Sep 28th, 2007 | Posted by | Filed under Typo3

When using RealURL in multi language environment sending an real 404 is sometimes not so easy. Some I just want to give you some hints:

First of all enable the pageNotFound_handling of Typo3.

  • open the file typo3conf/localconf.php
  • add these lines

    $TYPO3_CONF_VARS["FE"]["pageNotFound_handling"] = 'http://www.my-domain.com/en/not-found.html';
    $TYPO3_CONF_VARS["FE"]["pageNotFound_handling_statheader"] = 'HTTP/1.1 404 Not Found';

Now you need to check your RealURL config:

  • Be sure you that you have not set postVarSet_failureMode OR set it to postVarSet_failureMode=''
  • Also be sure you have defined 'noMatch'=>'bypass' for every single preVars section!

That’s all :-) Now you get the your wonderful 404 file not found page every time when a wrong page is hit.

Tags: