10. 301 Redirects

When launching a new website, it is often that you change the page structure or decide to exclude some pages. What then occurs, is that previous link addresses will no be valid (for example search results on Google), and this will result in a 404 Page not found.

If the page does not exist on the new website, this is of course the correct action. But if the page does exist, but in a different location, you can add the so called 301 redirect to avoid this.

This chapter will show you how to add these redirects in your TYPO3 7+ (and newer) installation.

Make a new record

If the redirect extention has been installed on you website, but not yet been set up, make a new page called "Redirects" of the type "Folder" in the page tree and click on it (1). Go to the "List" module in the TYPO3 module menu on the left side (2). At the top of the "List" module, click on the button (3) to create a new record. (img 10.1.)

In the selector "New record", click "Redirect" (4), which you can find below the headline "URL Forwarding" (img 10.2)

Type of redirect

First you select what kind of redirect you want to have. This can be done in the "General" tab in the first field with the label "Redirect to". (img 10.2.1)

Depending on the type of redirect ("Internal Page", "External URL", "Internal file") or "Path" you have just selected, the fields will change.

"Internal Page", "External URL", "Internal file" have only one field that differs - look field (7) on img.10.3 below.

"Internal Page" - type of redirect that is used to choose the exact page (from a page - tree of a site) the redirect should point to.

"External URL" - type of redirect that is used to choose external URL the redirect should point to.

"Internal file" -  type of redirect that is used to choose the exact file in the TYPO3 system the redirect should point to.

"Path"  - has 2 different fields to enter: instead of fields (6) and (7) on img.10.3. it has "Old path" and " New path" fields. It is obvious what we need to paste there, but it is necessary to remember that in the field "Old path" the address should be added WITHOUT the forward slash (/).

Edit the record

We will use as an example type "Internal page" (5). (img 10.3)

In the field "Source" (6) you fill in the path on which the redirect takes place. This referrs to the web address that the page had on the previous website. The domain or the transfer protocol (http/https) should not be included. For example, if you want the redirect to happen on http://domain.com/this/is/the/redirect/, you only enter this/is/the/redirect/. Slashes in front or at the end of the path are not mandatory.

In the field "Internal page" (7) you choose the page from a page tree - by clicking on the folder (8), where the redirect should point to. This is the new goal address for the redirected page.

In the field "HTTP Status" (9) you select what kind of header will be sent to the browser. This can be:

  • Moved permanently (301) - more often used, this means the resource was permanently moved to another URL and future requests should use that URL. Also it is good for SEO (Search Engine Optimization) value because 301s instruct clients to forget the value of the original URL.
  • Moved temporarily (302) - keeps the value of the original and can thus potentially reduce the value by creating two, logically-distinct URLs that each produce the same content (search engines view them as distinct duplicates rather than a single resource with two names).
  • See other location (303) - indicates that the resource has been replaced. With a 303 redirect the URL of the original page will be shown but title and description would be from the redirected page. So, 303 redirects don’t appear to work properly to search engines. If you want your permanent redirects to be counted by the search engines, avoid them and use 301 redirect instead.
  • Temporary redirect (307) - it means the redirect is temporary, and future requests should still use the original URL.

Be aware that a permanent redirect will stay in the browser cache of each visitor until this cache is cleared. Use this header wisely.

In the field "Limit to domains" (10) you can limit a redirect on one or more domains. If no domains are selected, the redirect will take place on all domains. When saving the record, the extension will check if the path (source) has been used already for another domain. If so, the record will not be saved, but you get a warning.

Field "Language" (11) is used when you have pages in multiple languages and you can select to which language variant of an internal page the redirect has to go. (img 10.3)

The tab "Access", allows you to set a period (start and stop date) for the redirect (img 10.4)

The tab "Request" includes some fields for your administration, especially convenient when you are working in a big organization. You can enter the name of the person who did the request for the redirect, on which date and some notes, such as the reason for the redirect. (img 10.5)

On the tab "Statistics" you will find non-editable fields, showing how many times the redirect has been requested and the date of the latest hit. (img 10.6)