Real URL (realurl)

Aus Wikizone
Wechseln zu: Navigation, Suche

Quickinfo

  • Configure Apache
  • Deactivate SimulateStaticDocs
  • TypoScript
  • Edit localconf.php (or use another tool like aeurltools or etarget realurlconfiguration


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>

NOTICE: USING httpd.conf is currently known not to work since t3lib_div::getIndpEnv('TYPO3_SITE_URL') is not correct. Solution remains to be found.

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”!

Also refer to the Appendix for extended information on mod_rewrite issues.

TS Config

config.simulateStaticDocuments = 0
config.baseURL = http://mydomain.com/
config.tx_realurl_enable = 1

localconf.php Configuration

with the variable $TYPO3_CONF_VARS['EXTCONF']['realurl']