- Part One Chapter 19 – Avoid Redirects
Part One Chapter 19
Redirect is a method that automatically takes your website users from one page to another. Your mobile website should avoid any redirect at all cost, as any redirect implemented on your mobile pages can considerably slow down page load speed.
The two major types of redirects are:
- Server-side redirects
- Client-side redirects
- Both 301 and 302 redirects are server-side redirects in which the web browser automatically takes the user from a page to a new/different location through HTTP.
- A 301 redirect indicates a page has been permanently moved to a new location. A 302 redirect indicates a page has been temporarily moved to a different location.
- Server-side redirects are relatively faster and are cacheable, among other redirect methods.
- Client-side redirects are generally slower and are not cacheable.
Redirect from Desktop Site to Mobile Site (when Browsing on Mobile Screens)
The reality is that in some cases you are totally unable to avoid redirects at all.
For example, your desktop site may have server-side redirect implemented to redirect all users to the mobile version of your site on the site-wide level when they visit your desktop site through mobile devices.
The reason behind this redirect setup is to improve users' experience. Users on mobile devices may visit the desktop version of your website (e.g. www.example.com). But while on the mobile screen, the user’s experience browsing your desktop site will usually be too bad. This will cause most users to immediately leave your desktop site.
In this case, you actually want the mobile users to land on your mobile site (e.g. m.example.com). You do this by implementing a redirect.
The downside is that the server-side redirect will reduce your mobile web pages' load speed.
Avoid All Client-side Redirects, Reduce Server-side Redirects
The least you can do:
- Avoid any client-side redirects, as they are relatively slow and they often cause user referrer information to be incorrectly recorded.
- Only implement server-side redirects when you have no any other viable option.
- Never link to a web page that has a redirect implemented on it. For example, if when visiting www.example.com/redirecting.html redirects you to www.example.com/redirected.html, then if you ever link to the page, you should link to www.example.com/redirected.html.
- Never set up more than one redirect to get from one page to another page. Example, if all you need is to redirect page A to page C, then create only this one server-side redirect. Do not create a redirect from page A to page B, and then a second redirect from page B to page C.
Tools to Check Redirects
To check if a page (URL) has redirects set up, use the “Redirect Checker” tool.
Gordon Choi's Mobile Website Book has been available since November 2016.
Content on Gordon Choi's Mobile Website Book is licensed under the CC Attribution-Noncommercial 4.0 International license.