In this article, You will get in-depth knowledge about TYPO3 redirects like how to activate core redirects extension, how-to guide on TYPO3 redirect backend module, best practices to use and migrate TYPO3 redirects from older-versions, useful 3rd party TYPO3 redirects extensions, etc. Let’s go!
Since TYPO3 v9, the community published TYPO3 redirects features within the TYPO3 core. It was a milestone released for integrators and editors to easily manage stuff with a dedicated “Site Management” backend module. I’ve written a related good article TYPO3 Routing Explained. Well, the redirects feature is small but essential for digital marketers for SEO and User-experience purposes.
For example, For dead-URLs, you never want to show “404 error” pages to your site’s loyal customers.
Make sure to activate TYPO3 core redirects
Let’s take a quick look at, how to use TYPO3 redirects in v9 onwards? Before that, make sure TYPO3 core extension redirects are enabled, You can quickly check with the below steps.
Step 1. Login to TYPO3 backend
Step 2. Go to Admin Tools > Extensions
Step 3. Search “Redirects”, Make sure it’s activated
Do you have a TYPO3 installation using an incredible composer? Then, You can easily install the TYPO3 redirects extension using a command.
composer require typo3/cms-redirects
How can you use TYPO3 core redirects?
That’s very easy! In TYPO3 backend, you’ll have a dedicated backend module called “Redirects”, Let’s see how it works.
Step 1. Go to Site Management > Redirects module
Step 2. Click on the “Create a new redirect” button
Step 3. Create a new redirect with fill-up information.
Source domain = *
Source path = /your-old-path
Target = choose page or url
Status code = 301 moved permanently.
You can also configure other settings like Force SSL redirect, Keep GET params, etc.
Developer Tips
If you are a TYPO3 developer, you may be familiar with PHP regular expression; you can use dynamic TYPO3 redirects at a source-path field.
Step 4. Done, that’s it. Take a test-drive of redirects at Frontend.
Automatically Pages Redirects Created
From TYPO3 v10, Whenever you change any of your page’s URL segments, the system will automatically set it as a redirect (from old-URL to new one ;)
Manage My TYPO3 Redirects
You can easily edit, delete, activate or deactivate TYPO3 redirects from the backend module.
Detect conflicting redirects
Since TYPO3 v10, you can check the conflict of redirects with CLI-command.
bin/typo3 redirects:checkintegrity
But, What about redirects in TYPO3 v8?
As above “Redirect” backend module is only available in TYPO3 v9 and above. But what are the best practices and solutions for TYPO3 v8? You can choose one of the below TYPO3 redirect options for TYPO3 v8.
Option #1 Mabahe Redirect
Marc Bastian Heinrichs created a TYPO3 extension to provide backward compatibility. It’s a composer package to integrate the redirects from version 9 into version 8.7. Since this feature needs some other patches for the core, the composer patches packages used to patch the core on the composer installs.
Option #2 My Redirects
Benjamin Serfhos developed and maintained the “My Redirects” extension since 2015. Simply install and enable the module in the backend. A backend user can be configured to add/edit the redirects if needed.
Option #3 URL Forwarding
Patrick Broens created the “URL Forwarding” extension with features of Redirects (301, 302, 303, 307) to internal/external page, file, or partial path replacement, based on domain and path.
Well, Do you want redirects in TYPO3 v7?
Simply manage (permanent 301) redirects in the list view. The extension supports multi-domain sites, counts the redirect usage, and shows the last referer.
Oh! Do you have a TYPO3 site in old-v6? No worries, there are many extensions available for such a version. And IMHO, Please consider upgrading your TYPO3 version at least to v9 before you hack ;)
Server Based TYPO3 Redirects
If you don’t wish to add redirects to the TYPO3 backend manually, then you can also configure your web servers like Apache or Ngnix.
Using Apache mod_rewrite
In your .htaccess or virtual host, you can configure “Redirect” as below samples.
Redirect 301 [old URL] [new URL]
Redirect 301 /blog blog.t3planet.com
Redirect 301 /store t3planet.com/typo3-extensions
Redirect permanent /secure t3planet.com/secure
Redirect 301 /oldlocation t3planet.com/newlocation
RewriteRule ^hello.html$ goodbye.html
RedirectMatch ^/images/(.*)$ cdn.t3planet.com/$1
RedirectMatch 301 ^(.*)$ t3planet.com$1
Add TYPO3 Redirects at Nginx
Nginx is getting more popular; If you want to configure redirects, you can use “rewrite” as below samples.
server {
# Temporary redirect to an individual page
rewrite ^/oldpage$ t3planet.com/newpage redirect;
}
server {
# Permanent redirect to an individual page
rewrite ^/oldpage$ t3planet.com/newpage permanent;
}
Migration guide to new TYPO3 core redirect
Whenever you do a TYPO3 update to TYPO3 v9 or more, I highly recommend migrating all your redirects from old-ways to TYPO3 core redirect extension. Let me give you an example of a popular one.
Migrate from EXT:realurl to EXT:redirects
Simply run the below SQL queries to migrate tx_reaurl_redirects to sys_redirect.
INSERT INTO `sys_redirect` (source_path,target,hitcount,target_statuscode,source_host) SELECT CONCAT('/',url),destination,counter,301,d.domainName FROM `tx_realurl_redirects` r LEFT JOIN sys_domain d ON r.domain_limit = d.uid;
UPDATE sys_redirect SET source_host = '*' WHERE source_host = '';
Migrate from EXT:my_redirects to EXT:redirects
Jigal van Hemert (one of the oldest and active TYPO3 community members), developed an extension to provide an Upgrade wizard to migrate redirects from RealUrl and MyRedirects to core redirects.
Migrate from url_forwarding to EXT:redirects
Similarly, you can migrate redirects data using the below SQL.
INSERT INTO `sys_redirect` (source_path,target,hitcount,target_statuscode,source_host) SELECT CONCAT('/',forward_url),CONCAT('t3://page?uid=',internal_page),counter,http_status,d.domainName FROM `tx_urlforwarding_domain_model_redirect` r LEFT JOIN `tx_urlforwarding_domain_mm` mm ON r.uid = mm.uid_local LEFT JOIN `sys_domain` d ON mm.uid_foreign = d.uid WHERE r.type = 0;
INSERT INTO `sys_redirect` (source_path,target,hitcount,target_statuscode,source_host) SELECT CONCAT('/',forward_url),external_url,counter,http_status,d.domainName FROM `tx_urlforwarding_domain_model_redirect` r LEFT JOIN `tx_urlforwarding_domain_mm` mm ON r.uid = mm.uid_local LEFT JOIN `sys_domain` d ON mm.uid_foreign = d.uid WHERE r.type = 1;
UPDATE sys_redirect SET source_host = '*' WHERE source_host = '';
Automatic Conditional TYPO3 Redirects
At your real-time TYPO3 projects, your customer often requests to have features like automatically redirect to customers browser or region based redirect - To improve end-user experience. The TYPO3 community is cool and always wanted to keep development with modern standards. Here is the list of features and TYPO3 extensions.
IP & Language Redirect
Alex Kellner (TYPO3 expert from In2Code) developed and maintained EXT:ipandlanguageredirect since 2017. TYPO3 extension to redirect a user based on location and browser language. This extension allows multi-language and multi-domain handling with redirects to the best relevant pages with the best fitting language based on the visitor’s browser language and region (IP-Address). Automatically redirect or show a note for the visitor to give him the best suitable website version for his/her needs.
Locate
Florian Wessels developed one of the other famous TYPO3 extensions. The users’ country and preferred language and other facts will be detected. Depending on configurable rules, the user can be redirected to other languages or pages. New functionality can be added easily.
Site Language Redirection
Harald Atteneder developed EXT:site_language_redirection. PSR-15 middleware to redirect the user to correct site language via HTTP headers (Accept-Language) and IP address.
Language Detection Redirect Resolver
Daniel Abplanalp developed EXT:ig_language_detection, Language detection in PSR-15 middleware stack on uri=/. Based on the Accept-Language Header the corresponding site config is chosen. Additional configuration in YAML site configuration is available like aliases and more.
Miscellaneous TYPO3 Redirects
I suggest checkout below small but cool miscellaneous TYPO3 redirects extensions.
Redirect to a page with trailing slashes
Georg Ringer (the TYPO3 news-man) developed small and useful EXT:redirect2trailingslash. Redirect URLs with no trailing slashes to the one with
RDCT Frontend redirects
Benni Mack (the TYPO3 Guru) developed EXT:rdct. Adds functionality to trigger redirects based on the &RDCT GET parameter. It’s an ancient and static "short-URL" functionality previously part of TYPO3 Core until TYPO3 v8. The functionality has been moved into its extension, receiving its public repository.
MiniRedirect
As the name suggests, Sven Juergens created EXT:miniredirect creative TYPO3 extension. A URL with uppercase letters or umlauts is forwarded to the lowercase URL with ae, oe, ue replacements.
Educational Video on TYPO3 Redirects
Last but not least, Mathias Schreiber (The TYPO3 man) created a cool TYPO3 redirect video, Must watch. Their videos are fantastic, just surprising, why they have stopped to make :(
Wrapping-up!
Thanks for reading my article.
I hope you have learned enough about TYPO3 redirects tips and tricks. Let’s conclude quickly;
- For TYPO3 >= v9, You should use the TYPO3 core's redirects feature.
- For TYPO3 <= v8, You can still use old TYPO3 redirects extensions like EXT:my_redirects
- At your TYPO3 update, Keep a checklist to migrate your old-way redirects (eg., EXT:realurl) to new-way TYPO3 redirects.
- Explore TYPO3 redirects add-ons to improve your end-user experience.
Do you have any questions or suggestions on TYPO3 redirects? Feel free to write below the comment box, and I’ll be happy to answer you.
Have a Happy TYPO3 Redirect :)
what do you think is better / faster: setting up redirects on the server-level (htaccess) or with a plugin on typo3 level?
I guess the server level redirects should lead to faster execution times.
Thanks!