RealURL

1.2. Configuration

1.2.1. Installation

To install this extension, four steps must be taken:

  1. Install it in the Extension Manager

  2. Configure Apache

  3. Modify your templates for Real URLs

  4. Configure the extension in typo3conf/localconf.php

Install the extension

This is documented very well in the usual TYPO3 docs: just click the little gray sphere with the plus-sign and when it asks for any changes to commit, let it make them. It's not doing anything yet though.

Configure Apache

RealURLs work by providing 'virtual paths' to 'virtual files'. These don't actually exist on the file-system, so you must tell Apache to let a PHP-script handle the request if it can't find the file. This way, all URLs to pages (like www.server.com/products/product1/left.html) will be 'redirected' to /index.php, which will handle the translation of the URL into GET parameters. Real files (like images, the TYPO3 backend, static html-files, etc.) will still be handled by Apache itself though.

You should put the supplied sample .htaccess file (called _.htaccess) in the root of your TYPO3-installation.

Alternatively, you could include the following lines in your httpd.conf, probably in the VirtualHost-section. Here is an example:

  <VirtualHost 127.0.0.1> 
      DocumentRoot /var/www/typo3/dev/testsite-3/ 
      ServerName www.test1.intra 
    
      RewriteEngine On 
      RewriteRule ^/typo3$ - [L] 
      RewriteRule ^/typo3/.*$ - [L] 
       
      RewriteCond %{REQUEST_FILENAME} !-f 
      RewriteCond %{REQUEST_FILENAME} !-d 
      RewriteCond %{REQUEST_FILENAME} !-l 
      RewriteRule .* /index.php 
  </VirtualHost> 

 

If you put it into a .htaccess file it has to look slightly different, basically stripping the leading slashes ("/"):

  RewriteEngine On 
  RewriteRule ^typo3$ - [L] 
  RewriteRule ^typo3/.*$ - [L] 
    
  RewriteCond %{REQUEST_FILENAME} !-f 
  RewriteCond %{REQUEST_FILENAME} !-d 
  RewriteCond %{REQUEST_FILENAME} !-l 
  RewriteRule .* index.php 
    

This will tell Apache that it should rewrite every URL that's not a filename, directory or symlink. It leaves everything starting with /typo3/ alone too.

Notice: For this work you need the Apache module "mod_rewrite"!

TypoScript configuration

Like with "simulateStaticDocuments" you need to activate the generation of the virtual file/path names in the TypoScript record – otherwise your website will not utilize the new URL encoding method.

However that is trivial; just place these four lines in the main TypoScript template record of your website:

     0: config.simulateStaticDocuments = 0 
     1: config.baseURL = 1 
     2: config.tx_realurl_enable = 1 

Line 0 simply disables "simulateStaticDocuments" - "realurl" is incompatible with simulateStaticDocuments and will simply not work if it has been enabled. This line should remind you of this fact.

Line 1 makes the frontend output a "<base>" tag in the header of the pages. This is required because relative references to images, stylesheets etc. will break when the virtual paths are used unless this has been set. Please see below for a detail discussion of why this is needed.

Line 2 enables the encoding of URLs as the virtual paths, the "Speaking URLs".

Configure the extension

Finally, you probably want to configure the way URLs are encoded. For simple needs this is quite easy and the more advanced URLs you want to encode the more configuration you need - simple isn't it.

Configuration is done in "localconf.php" with the variable $TYPO3_CONF_VARS['EXTCONF']['realurl']

Please see the section later dealing with configuration options. It also offers a lot of examples.

To top


Valid XHTML 1.0!