Email  Print  Favorites | More

Simulating Static Pages with Typo3

Simulating static pages in Typo3 is really simple as all pages inside a Typo3 installation are called from the index.php file on the root of your website.

To make it work with the Apache webserver, Apache needs to have rewrite module intalled, loaded and working.

Configuring Apache

In my particular intallation of Apache there is a line in the httpd.conf that is like this:

LoadModule rewrite_module modules/mod_rewrite.so

Make sure that line is there and that is not commented out.

The next step is to verify if your particular installation allows you to override security settings by putting a .htaccess file in the root directory of your website. You can either allow that for all your virtual servers, or you can allow it only in some particular servers.

This is an example of a virtual server configuration file:

<VirtualHost xxx.xxx.xxx.xxx:80>
DocumentRoot /path/to/document/root
ServerName www.xxx.xxx
ServerAlias xxx.xxx
   <Directory "/path/to/document/root">
   AllowOverride All
   </Directory>

ErrorDocument 404 http://www.xxx.xxx
</VirtualHost>

After the virtual server (or the whole Apache) configuration has been changed, you need to restart Apache.

Now you can place an .htaccess file in the root directory of your web installation.

Something like this could work:

 

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^typo3$ typo3/index_re.php
RewriteRule ^[^/]*\.html$ index.php
RewriteRule test.html index.php

Create a plain text file, name it .htaccess, copy the lines of code that are above to it and put that file in your website root installation.

Please notice the last line:

RewriteRule   test.html index.php

I just put in there for testing purposes. You can delete it after you Know the rewite module is working.

Testing the Apache Rewrite Module

If everything went ok, you should go to your website and try the test:

http://www.your.website/test.html

After doing that, you should get redirected to index.php, if not, then something is not working in your redirection and you should not continue this tutotial until you get it right.

If after doing that you get redirected to index.php, then your redirection is working and you can delete the last line of the .htaccess file.

TypoScript Code

Put the following TypoScript code on your main template:

config.simulateStaticDocuments=1

config.simulateStaticDocuments_addTitle=30

The first line activates the Simulate Static Documents Option

The second line shows the number of digits the title can have

Save the TypoScript, clear all cache and that should do the trick.

Good Luck!