SEO News

HTML Redirects: What They Are & How to Set One Up


What Is An HTML Redirect?

An HTML redirect, also known as a meta redirect or a meta refresh redirect, tells the visitor’s web browser to send users from one webpage to another.

HTML redirects can either be instant or delayed.

Instant redirects happen immediately. Delayed redirects happen after a specific number of seconds (set by the website owner).

Here’s how it works:

  1. A user lands on a webpage with a meta redirect
  2. The redirect is triggered in one of two ways:
    1. If the redirect is instant, the user is sent to the new page as soon as the HTML of the current page loads
    2. If the redirect is delayed, the user is sent to the new page after the HTML loads and the set amount of time has passed 
  3. The redirect occurs, and the user is now on the new page and can continue their journey
an image illustrating instant vs delayed HTML redirects

Why Use an HTML Redirect

HTML redirects can be convenient to implement since they’re set within the HTML of a webpage. You don’t need access to server files—like the .htaccess file—to implement one.

They can be useful when you’re doing maintenance on a page and need to redirect users to a temporary page. Or when you no longer want to use a page and need to send users somewhere else permanently.

Other types of redirects—like server-side redirects—may require you to access your server files. Which can be challenging (although plugins often make this much easier).

Although HTML redirects can be convenient, there are a few reasons to avoid them:

  1. They might not work properly on older browsers and lead to a poor user experience
  2. Since the HTML of the old page needs to load before the redirect occurs, they can be slow and frustrating to users
  3. They don’t pass along as much link equity (from the original page) as other types of redirects which can affect your SEO
  4. Delayed HTML redirects can present accessibility issues for people with screen readers or people who are unable to read text quickly
  5. Since you need the HTML of the first page, you can’t permanently delete any of the pages you want to redirect and must keep them up and running. This isn’t ideal if you want to reorganize your site’s structure.

How to Redirect a Page to Another Page in HTML

To add a redirection in your HTML, paste the below code into the <head> section of the page you want to redirect (and replace the URL value):

<meta http-equiv="refresh" content="3; URL=https://www.yoururl.com/newpage" />

In this code:

  • http-equiv=“refresh” tells the browser to redirect the page
  • content=“3; tells the browser how many seconds to wait before refreshing the page. In this example, it’s three seconds. To make it an instant redirect, set it to “0.”
  • URL=“URL=https://www.yoururl.com/newpage” tells the browser which URL to send users to

Just make sure you’re careful when choosing between an instant and a delayed redirect. Google interprets instant redirects as permanent (meaning you don’t plan to use the redirected page again) and delayed redirects as temporary.

HTML Redirect Best Practices and Examples

1. Avoid Redirecting to Redirected Pages

Redirecting to a page that already has a redirect is known as a redirect chain.

Imagine you land on a website, and shortly after getting there, it redirects you to a new page. And then that page redirects you to a new page …

Sounds frustrating, right?

an image illustrating a redirect chain

Not only is this annoying for users, it’s also bad for your SEO.

You can easily avoid redirect chains—and keep users happy—by sending traffic to pages that don’t have any redirects configured.

2. Redirect to a Relevant Page

When possible, send users to a relevant page to decrease the chance of them leaving your site altogether. 

Users land on your page because they have a need.

Maybe they want to learn more about your business, contact you, or make a purchase.

Try to determine that need and redirect users to a similar page.

For example, let’s say you sell shoes and have a product page for purple sneakers. One day, you sell out of purple sneakers and need to direct traffic elsewhere temporarily.

Which product page makes more sense: another sneaker page or a page for high-heels? Probably the sneaker page.

By sending traffic to a relevant page, you’re meeting users where they are so they can continue their journey.

3. Tell Users Why You’re Redirecting Them 

When you set a redirect in HTML, your HTML needs to load before the redirect occurs.

Even if you set an instant redirect, if your user’s internet is slow, they could still see a portion of the initial page before they’re redirected.

Instead of showing them a blank page, add a blurb so they know why you’re redirecting them.

Just be sure the copy you include on the page is short and easy to read. Aim for 20 words or fewer. This way, users can quickly read about the redirection before it happens.

Older browsers may not support HTML redirects, which means if someone lands on your page, they won’t get redirected to the new one.

Whether your redirect is delayed or instant, include a link to the new page so users can click onward if the redirect doesn’t work.

This way, you don’t need to worry about losing any traffic and can ensure visitors end up at the right spot.

an image illustrating "This page no longer exists" page with redirect

5. Ensure Delayed Redirects Are Timed Properly

Make sure your redirects aren’t too long or too short. Five seconds is usually sufficient.

If a delayed redirect takes too long, you risk users bouncing—and those users may never end up on your site again.

And if users have to read a message, but the redirect is too short, they might feel just as frustrated.

Test your delayed redirect to make sure it’s not too long—or short.

Better Alternatives to HTML Redirects

301 and 302 redirects are faster than HTML redirects, are less likely to hurt your SEO, and have less impact on the user experience on your site. 

Here’s when to use each one:

301 Redirects

301 redirects are permanent redirects that tell search engines you’ve moved content to a new URL.

Use these when you:

  • Want to direct users from HTTP to HTTPS
  • Merge two pages together 
  • Delete a page and replace it with something else
an image illustrating a deleted page with 301 redirect to a new page

With a 301 redirect, you’re telling search engines the old page no longer exists. 

This way, you pass on much of the link equity from the old page to the new page. And search engines know to update the old link with the new one in the search results.

302 Redirects

302 redirects are temporary redirects. 

They’re useful if you need to redirect users for a certain period of time. Like when you need to perform page updates or want to run an A/B test. 

For example, you can implement a 302 redirect for a landing page to test which call-to-action copy results in more conversions.

an image illustrating a 302 temporary redirect

However, because 302 redirects are only temporary, search engines may not update the search results with the new link.

This means you need to keep track of your 302 redirects and remove them when you no longer need them.

How to Audit Your Redirects

If your site has redirects, you’ll want a fuss-free way to audit them and make sure they’re working as intended.

You can keep a spreadsheet, but spreadsheets can be tedious to manage.

Plus, if you forget to add a redirect to your sheet, you might forget about it (and forget to remove it if needed).

An easier way is to use Semrush’s Site Audit tool.

To start, go to “Site Audit” and set up a new project or click on the existing project you’d like to identify the redirects for.

Semrush’s Site Audit tool

Then, click the number beside “Redirects.”

an arrow pointing to the number beside “Redirects” showing 339

Here, you’ll see a list of the redirects on your site, where you can make sure each page has the right type of redirect.

a list of the redirects on your site in Site Audit tool

This report also helps you spot redirect chains.

Here’s how.

Under “Issues” search for “redirect chain.”

search for “redirect chain”

Click on “# redirect chains and loops.”

“102 redirect chains and loops” button highlighted

Use this report to identify—and then fix—pages with multiple redirects to give users a better experience on your site.

"Page URL with redirect link" section highlighted in the report

Using Semrush’s Site Audit tool, you can be confident that users always end up where they’re supposed to, without any hassle.



Source link : Semrush.com

Related Articles

Back to top button
Social media & sharing icons powered by UltimatelySocial
error

Enjoy Our Website? Please share :) Thank you!