Speaking URLs with TYPO3
Note: This content is obsolete, and kept for archive purposes only.
I’ve been using TYPO3 for a while and since it’s a fairly advanced system with many pitfalls, I would like to share some of my experiences concerning speaking URLs.
So what is a speaking URL? The standard look of Typo3 URLs, as with many PHP solutions using a database, looks like this:
But it would be better with:
based on the actual page context. Apart from aesthetic reasons there are other good reasons, such as search engine optimization. This makeover is done by using the extension RealURL in combination with web server modifications.
Web server configuration
If you are using the Apache web server, modify .htaccess like this:
The file should be located in the root of your TYPO3 tree.
In order to use the .htaccess file, you must modify http.conf like this:
Note to Windows users: As you may know, a file cannot be renamed into “.something” directly from the Windows Explorer. Instead you may rename it using the command prompt, or open the file in an application such as Notepad and save it with the correct name.
If you prefer the Microsoft IIS web server, something like this will work as well:
You may also want to increase the PHP heap a bit to avoid fuzzy error messages. To do this, modify php.ini like this:
Now you are almost up and running. Just enter these lines into your TYPO3 template:
The first line disables simulateStaticDocuments, since the two techniques are incompatible.
View a page to see the result. You may have to clear the cache.
But the fun doesn’t stop there! If you want news management on the site, there are further modifications ahead.
The extension called tt_news is very flexible and an ideal choice for most applications. However, the standard version is not capable of generating nice URLs with RealURL, so it has to be modified a bit.
Start with version 2.1.1 of tt_news. This version must be downloaded and installed separately (T3X_tt_news-2_1_1.t3x), since it is not available directly from the extension manager.
Enter the TYPO3 backend and create a sysfolder called News for the news categories.
Go to the News page (not the sysfolder) and modify it’s template by adding the following to the Constants field:
where news_display_pid is the id of your News page and news_template.tmpl is the HTML template.
Hope this helps. Note that the configurations I describe are just examples and your actual configuration may vary.