donators

n@work Internet Informationssysteme GmbH
Your ad here

supported by

 TYPO3 Hamburg
 TYPO3 Anbieter

Advertising

Basic RealURL setup

By: Martin Adler

12.04.06 09:34 Age: 2 yrs

I don't want this ugly index.php?id=123 type of URLs anymore. How can I change this to have something like directory structure?

For doing this you can use the extension "realurl". In cooperation with the Apache rewrite module It translates nice structurized URL paths into a format that TYPO3 can understand.

 

Step 1 - setup mod_rewrite

To tell mod_rewrite to pass everything not under typo3 which is not a file, dir or symlink to index.php for rewriting put this in your .htaccess. (NOTE: this is not necessary with current version of the provided .htaccess ... you will just need to enable (rename)) it..

  1.  
  2. RewriteEngine On
  3. RewriteRule ^typo3$ - [L]
  4. RewriteRule ^typo3/.*$ - [L]
  5. RewriteCond %{REQUEST_FILENAME} !-f
  6. RewriteCond %{REQUEST_FILENAME} !-d
  7. RewriteCond %{REQUEST_FILENAME} !-l
  8. RewriteRule .* index.php
  9.  

 

Step 2 - Prepare template setup

Put this in your root template setup

  1.  
  2. config.simulateStaticDocuments = 0
  3. config.baseURL = localhost/devsite
  4. config.tx_realurl_enable = 1
  5.  

NOTE: since Typo3 3.8.1 config.baseURL has to be the URL to your site and can not be 1 ... see http://wiki.typo3.org/index.php/TYPO3_3.8.1 for details. The documentation both in the TSRef and the RealURL manual is outdated on this matter.

 

Step 3 - Configure extension in localconf.php

Insert this into your localconf.php to get off the ground quickly

  1.  
  2. $TYPO3_CONF_VARS['EXTCONF']['realurl']['_DEFAULT'] = array(
  3.         'preVars' => array(
  4.                 array(
  5.                         'GETvar' => 'L',
  6.                         'valueMap' => array(
  7.                                 'dk' => '1',
  8.                         ),
  9.                         'noMatch' => 'bypass',
  10.                 ),
  11.         ),
  12.         'fileName' => array (
  13.                 'index' => array(
  14.                         'page.html' => array(
  15.                                 'keyValues' => array (
  16.                                 'type' => 1,
  17.                                 )
  18.                         ),
  19.                         '_DEFAULT' => array(
  20.                                 'keyValues' => array(
  21.                                 )
  22.                         ),
  23.                 ),
  24.         ),
  25.         'postVarSets' => array(
  26.                 '_DEFAULT' => array (
  27.                         'news' => array(
  28.                                 array(
  29.                                         'GETvar' => 'tx_mininews[mode]',
  30.                                         'valueMap' => array(
  31.                                                 'list' => 1,
  32.                                                 'details' => 2,
  33.                                         )
  34.                                 ),
  35.                                 array(
  36.                                         'GETvar' => 'tx_mininews[showUid]',
  37.                                 ),
  38.                         ),
  39.                 ),
  40.         ),
  41. );
  42.  

For further detail of this extension please see the realurl manual available here: http://typo3.org/documentation/document-library/extension-manuals/realurl/current/view/toc/0/

Found a mistake?

If you found a mistake or if you have a good tip or suggestion, please contact me at thomas(at)typo3-unleashed.net. I will check it and correct the entry or insert the new one.

Thanks in advance for your help.