[TYPO3-english] Realurl, default language and 404 page

Pascal Cramer pascal at NOSPAMroguesheep.nl
Mon Feb 9 12:04:26 CET 2009


Hi Dmitry,

thanks for replying!

Dmitry Dulepov wrote:
> Hi!
> 
> Pascal Cramer wrote:
>> However, removing this statement causes Realurl to resolve invalid url's
>> without any language prevar to the homepage.
>> For example http://www._domain_.com/en/non_existing_page.html is
>> 'thrown' to the defined [FE][pageNotFound_handling] but
>> http://www._domain_.com/non_existing_page.html wil result in the
>> homepage being presented (with a http response code 200)
> 
> For me RealURL shows 404 page, not the home page. Are you sure you posted full configuration?
Yes, it is the full config but without the part of another domain, since this 
wil not infere with the _DEFAULT setup?
Here is the complete file:
------
<?php

// RealURL configuration.
//
  $TYPO3_CONF_VARS['EXTCONF']['realurl'] = array(

'www._anotherdomain_.com' => array(
       'init' => array(
	 'enableCHashCache' => 1,
       ),
        'preVars' => array(
       ),

        'fileName' => array(
           'defaultToHTMLsuffixOnPrev' => '1',
       ),

        'pagePath' => array(
           'type' => 'user',
           'userFunc' => 
'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
           'spaceCharacter' => '-',
           'languageGetVar' => 'L',
           'expireDays' => '3',
           'rootpage_id' => '951',
       ),

        'fixedPostVars' => array(
       ),

     // tt_news
     'postVarSets' => array(
       '_DEFAULT' => array(
         // news archive parameters
         'archive' => array(
           array(
             'GETvar' => 'tx_ttnews[year]' ,
             ),
           array(
             'GETvar' => 'tx_ttnews[month]' ,
             'valueMap' => array(
               'january' => '01',
               'february' => '02',
               'march' => '03',
               'april' => '04',
               'may' => '05',
               'june' => '06',
               'july' => '07',
               'august' => '08',
               'september' => '09',
               'october' => '10',
               'november' => '11',
               'december' => '12',
               )
             ),
           array(
	     'GETvar' => 'tx_ttnews[day]' ,
	    ),

           ),
         // news pagebrowser
         'browse' => array(
           array(
             'GETvar' => 'tx_ttnews[pointer]',
             ),
           ),
         // news categories
         'select_category' => array (
           array(
             'GETvar' => 'tx_ttnews[cat]',
             ),
           ),
         // news articles and searchwords
         'article' => array(
           array(
               'GETvar' => 'tx_ttnews[backPid]',
                 ),
           array(
             'GETvar' => 'tx_ttnews[tt_news]',
             'lookUpTable' => array(
               'table' => 'tt_news',
               'id_field' => 'uid',
               'alias_field' => 'title',
               'addWhereClause' => ' AND NOT deleted',
               'useUniqueCache' => 1,
               'useUniqueCache_conf' => array(
                 'strtolower' => 1,
                 'spaceCharacter' => '-',
                 ),
               ),
             ),
           array(
             'GETvar' => 'tx_ttnews[swords]',
             ),
           ),
         ),
       ),
     // tt_news rss feeds
     'fileName' => array(
       'index' => array(
         'rss.xml' => array(
           'keyValues' => array(
             'type' => 100,
           ),
         ),
         'rss091.xml' => array(
           'keyValues' => array(
             'type' => 101,
           ),
         ),
         'rdf.xml' => array(
           'keyValues' => array(
             'type' => 102,
           ),
         ),
         'atom.xml' => array(
           'keyValues' => array(
             'type' => 103,
           ),
         ),
       ),
     ),

    ),

     '_DEFAULT' => array(
        'preVars' => array(
           '0' => array(
              'GETvar' => 'L',
              'valueMap' => array(
                 'en' => '0',
                 'de' => '1',
                 'nl' => '2',
                 'fr' => '3',
             ),

              'valueDefault' => 'en',
          ),

       ),

        'fileName' => array(
           'defaultToHTMLsuffixOnPrev' => '1',
       ),

        'pagePath' => array(
           'type' => 'user',
           'userFunc' => 
'EXT:realurl/class.tx_realurl_advanced.php:&tx_realurl_advanced->main',
           'spaceCharacter' => '-',
           'languageGetVar' => 'L',
           'autoUpdatePathCache' => 1,
           'expireDays' => '730',
           'rootpage_id' => '1',
       ),

        'fixedPostVars' => array(
       ),

    ),

);

?>
------

> 
>> I have been through the Realurl manual and Google several times but
>> perhaps I missed something or have I been searching for the wrong things?
>>
>> 2. Another thing are the redirects for the country-specific domains.
>> We would like to redirect only the 'bare' tld-requests to their
>> corresponding language, for example http://www._domain_.nl/ should be
>> redirected to http://www._domain_.com/nl/, any other requests on the .nl
>> domain should be handled through [FE][pageNotFound_handling]
>> (fb_old2newredirects)
> 
> Use mod_rewrite for it. Using PHP+TYPO3+RealURL is very inefficient way. Here is an example:
> 
> RewriteCond %{HTTP_HOST} ^(www\.)?example\.com$
> RewriteRule ^(nl/)?(.*)$ http://example.com/nl/$1 [L,R]
> 
Thanks for this tip, I'm going to try it!

Pascal


More information about the TYPO3-english mailing list