TYPO3: 301 redirect pages or tt_news records
I’m getting a lot of traffic lately of people searching for a tutorial on 301 redirects, especially in combination with tt_news. Therefore I’m going to explain how to make such a redirect the easiest way. In this tutorial I’m assuming you already have a website up and running with RealURL installed and you want to setup a 301 redirect for a page or news record which no longer exist.
Note: If you don't know anything about a 301 redirect please read the grey box at the bottom of the article!
Redirecting a page using 301
In this tutorial we have 2 pages: a news list page and a news single page
Now, since both page 1 and 2 are well indexed in Google and there are several inbound links we don’t want to delete either of them. Yet the first news item had become obsolete and we want to redirect all these inbound links to another page.
If we delete the first page the visitor will end up with a 404 page. A 301 redirect could redirect the first pages to another page, and this is Google friendly too! So… how to do this?
1. In the backend, go the 'info' module in the left main menu. 2. Select the rootpage of your website. 3. Choose "Speaking Url Management" from the dropdown menu. 4. Choose "Error log" from the second dropdown menu.
You should now see a list of url errors:
It seems the page ‘old-news-page’ has been requested by a visitor but could not be found. To make sure this won’t happen again we are going to redirect this page to our new page: ‘news’. As you can see, there’s a little button called ‘set as redirect’. Click this button to set the redirect for this url. You should now see the following screen:
In the screenshot above I’m redirecting the page ‘old-news-page’ to the new page: ‘news’. As you can see I activate the ‘Send “301 Moved permanently” header’ checkbox. Now TYPO3 will make the redirect a 301 redirect!
1. Set the old url (this way it's set automatically) 2. Set the new page 3. Save the redirect 4. Go to http://www.your-website.com/old-news-page/ 5. TYPO3 will redirect you to http://www.your-website.com/news/ 6. Redirect succesful!
Now let’s see how we can make this work for tt_news!
Redirecting a tt_news record using 301
When you delete a news record and try to visit it you’ll end up with a ‘no news id’ error. The RealURL Management Error Log does not register this error! So, we need to manually set the redirect.
In this case we have 2 news records:
To redirect news record 1 to news record 2, please follow the following steps:
1. In the backend, go the 'info' module again. 2. Select the rootpage of your website. 3. Choose "Speaking Url Management" from the dropdown menu. 4. Choose "Redirects" from the second dropdown menu. We're back at the second screenshot above! 5. Click '+ New entry' 6. Set the url which no longer exists 7. Set the new url to which you want to redirect 8. Check the 301 checkbox 9. Save and enjoy!
That’s it, your done! Repeat this procedure for all news items you delete. Hope this tutorial was clear and helpful. If you have any questions don’t hesitate to ask.
What is a 301 redirect?
A 301 redirect is a redirect which uses a 301 http-header code. This code tells search engines the page is no longer available at the given location but is 'permanently moved' to another location. The resource (e.g. search engine) should use the new URL in the future instead of the old URL. In real life this would mean the old page should be replaced by the new page upon re-indexing. This is a good thing! Now the search enige realizes the old page doesn't contain the information which is being looked for. The new page does, so your pageranking is preserved. A win-win situation: We happy (pageranking preserved), seach engine happy (page contains good information) and visitor happy (finds the information it's looking for).