URL Reroutes For SEO: A Technical Guide

Posted by

Reroutes for SEO should be utilized properly since they affect how sites are crawled and indexed by Google.

While most people think of redirects as an internet detour sign, far more is happening, and it’s remarkably enjoyable to discover.

Keep reading for an extensive introduction of redirects and the proper application for technical SEO.

What Is A Redirect?

Site reroutes inform browsers and online search engine details about a URL and where to discover the webpage.

A URL redirect involves code executed to a specific URL, or a group of URLs so that the user (or search engine) is sent to a various page to the real URL that was input or clicked.

A redirect can be set as a:

  • Momentary redirect: 302, 303, 307, 308.
  • Long-term redirect: 301.

When To Utilize Redirects

The primary reasons to use redirects are:

  • An individual page or entire domain has actually been moved (URL changed).
  • To enable the use of URL shorteners or ‘quite URLs.’
  • Website migration (e.g., HTTP to HTTPS).

For SEO functions, URL redirects are important since they:

  • Forward authority of any links pointing to a page that has actually moved or been erased.
  • Avoid 404 page not found errors (although often it is much better to leave a 404).

Redirects can be executed on a group or domain-wide basis but typically require to be set on a private basis to prevent issues.

When using RegEX for group reroutes, it can have unforeseen outcomes if your reasoning isn’t flawless!

Kinds of Redirects

There are three main types of redirects:

  • Meta Refresh redirects are set at the page level but are usually not advised for SEO functions. There are two types of meta redirect: delayed which is seen as a short-term redirect, and instant, which is viewed as a permanent redirect.
  • Javascript redirects are also set on the customer side’s page and can trigger SEO issues. Google has stated a preference for HTTP server-side reroutes.
  • HTTP redirects are set server-side and the very best approach for SEO functions– we covered thorough listed below.

What Is A HTTP Action Status Code?

Web browsers and online search engine crawlers like GoogleBot are called user agents.

When a user representative tries to access a webpage, what occurs is that the user representative makes a demand, and the website server issues an action.

The action is called an HTTP action status code. It provides a status for the ask for a URL.

In the situation where a user agent like GoogleBot requests a URL, the server gives a reaction.

For example, if the ask for a URL achieves success, the server will supply an action code of 200, which suggests the ask for a URL succeeded.

So, when you think about a GoogleBot reaching a site and trying to crawl it, what’s happening is a series of demands and actions.

HTTP Reroutes

An HTTP redirect is a server reaction to ask for a URL.

If the URL exists at a different URL (due to the fact that it was moved), the server tells the user representative that the URL request is being rerouted to a various URL.

The action code for a changed URL is normally in the kind of a 301 or 302 response status code.

The entire 3xx series of reaction codes interact much info that can optionally be acted on by the user representative.

An example of an action that the user representative can take is to conserve a cache of the brand-new URL so that the next time the old URL is asked for, it will request for the new URL instead.

So, a 301 and a 302 redirect is more than an internet road sign that states, “Go here, not there.”

3XX Series Of Status Codes

Redirects are more than simply the two status codes everybody recognizes with, the 301 and 302 action codes.

There are an overall of seven main 3xx reaction status codes.

These are the different sort of redirects available for usage:

  • 300 Multiple Choices.
  • 301 Moved Permanently.
  • 302 Found.
  • 303 See Other.
  • 304 Not Modified.
  • 305 Usage Proxy.
  • 306 (Unused).
  • 307 Temporary Redirect.
  • 308 Long-term Redirect.

A few of the above status codes have actually not been around as long and might not be utilized. So, prior to using any redirect code aside from 301 or 302, make sure that the intended user agent can interpret it.

Because GoogleBot uses the most recent version of Chrome (called a headless browser), it’s easy to check if a status code works by checking if Chrome recognizes the status code with an internet browser compatibility list.

For SEO, one should stay with using the 301 and 302 reaction codes unless there is a specific reason to use among the other codes.

301: Moved Permanently

The 301 status code is regularly referenced as the 301 redirects. But the main name is 301 Moved Permanently.

The 301 redirect suggests to a user representative that the URL (sometimes referred to as a target resource or just resource) was changed to another location which it need to use the new URL for future demands.

As pointed out earlier, there is more info also.

The 301 status code likewise suggests to the user representative:

  • Future ask for the URL ought to be made with the brand-new URL.
  • Whoever is making the request ought to update their links to the new URL.
  • Subsequent demands can be altered from GET to POST.

That last point is a technical problem. According to the main requirements for the 301 status code:

“Note: For historic reasons, a user agent MAY change the request approach from POST to GET for the subsequent request. If this behavior is unwanted, the 308 (Irreversible Redirect) status code can be used instead.”

For SEO, when online search engine see a 301 redirect, they pass the old page’s ranking to the new one.

Prior to making a modification, you should beware when utilizing a 301 redirect. The 301 redirects should only be used when the change to a new URL is long-term.

The 301 status code should not be used when the change is short-term.

Additionally, if you change your mind later on and return to the old URL, the old URL may not rank anymore and might take some time to gain back the rankings.

So, the main thing to bear in mind is that a 301 status code will be used when the modification is permanent.

302: Found

The main thing to comprehend about the 302 status code is that it’s useful for scenarios where a URL is momentarily changed.

The significance of this action code is that the URL is momentarily at a different URL, and it is recommended to use the old URL for future demands.

The 302 redirect status code also includes a technical caveat related to GET and Post:

“Keep in mind: For historical reasons, a user representative MAY alter the demand method from POST to GET for the subsequent demand. If this behavior is undesirable, the 307 (Momentary Redirect) status code can be utilized rather.”

The reference to “historical reasons” might describe old or buggy user agents that may alter the demand technique.

307: Temporary Redirect

A 307 redirect implies the asked for URL is momentarily moved, and the user agent need to utilize the original URL for future demands.

The only difference in between a 302 and a 307 status code is that a user representative should request the new URL with the same HTTP request used to ask for the initial URL.

That implies if the user agent requests the page with a GET demand, then the user representative should use a GET request for the brand-new temporary URL and can not utilize the POST demand.

The Mozilla paperwork of the 307 status code describes it more plainly than the official paperwork.

“The server sends this response to direct the client to get the requested resource at another URI with same approach that was utilized in the previous demand.

This has the same semantics as the 302 Found HTTP action code, with the exception that the user representative need to not change the HTTP technique utilized: if a POST was used in the very first demand, a POST should be utilized in the second request.”

Other than the 307 status code needing subsequent requests to be of the exact same kind (POST or GET) and that the 302 can go in any case, whatever else is the same between the 302 and the 307 status codes.

302 Vs. 307

You may manage a redirect through server config files.htaccess on Apache, example.conf file on Nginx or through plugins if you are utilizing WordPress.

In all circumstances, they have the same syntax for composing redirect guidelines. They differ only with commands utilized in configuration files. For instance, a redirect on Apache will appear like this:

Choices +FollowSymlinks RewriteEngine on RedirectMatch 301 ^/ oldfolder// newfolder/

(You can check out symlinks here.)

On Nginx servers, it will appear like this:

rewrite ^/ oldfolder// newfolder/ irreversible;

The commands used to inform the server’s status code of redirect and the action command differ.

For example:

  • Servers status code of redirect: “301 ″ vs. “long-term.”
  • Action command: “RedirectMatch” vs. “reword.”

But the redirect syntax (^/ oldfolder// newfolder/) is the exact same for both.

On Apache, ensure that mod_rewrite and mod_alias modules (accountable for dealing with redirects) are made it possible for on your server.

Since the most extensively spread server type is Apache, here are examples for.htaccess apache files.

Ensure that the.htaccess file has these 2 lines above the redirect rules and put the rules below them:

Choices +FollowSymlinks RewriteEngine on

Read the official documentation to find out more about the RewriteEngine.

To comprehend the examples listed below, you might describe the table listed below on RegExp fundamentals.

* no or more times
+ One or more times
. any single character
? Zero or one time
^ Start of the string
$ End of the string
| b OR operadn” |” a or b
(z) remembers the match to be utilized when calling $1

How To Produce Redirects

How To Develop A Redirect For A Single URL

The most common and commonly used type of redirect is when deleting pages or altering URLs.

For example, state you changed the URL from/ old-page/ to/ new-page/. The redirect guideline would be:

RewriteRule ^ old-page(/? |/. *)$/ new-page/ [R=301, L] Or RedirectMatch 301 ^/ old-page(/? |/. *)$/ new-page/

The only distinction in between the 2 techniques is that the first uses the Apache mod_rewrite module, and the second uses mod_alias. It can be done utilizing both techniques.

The routine expression “^” indicates the URL must begin with “/ old-page” while (/? |/. *)$ shows that anything that follows “/ old-page/” with a slash “/” or without an exact match should be redirected to/ new-page/.

We might also utilize (. *), i.e., ^/ old-page(. *), but the issue is, if you have another page with a comparable URL like/ old-page-other/, it will also be rerouted when we just want to redirect/ old-page/.

The following URLs will match and be directed to a brand-new page:

/ old-page/ / new-page/
/ old-page / new-page/
/ old-page/? utm_source=facebook.com / new-page/? utm_source=facebook.com
/ old-page/child-page/ / new-page/

It will redirect any variation of the page URL to a brand-new one. If we utilize reroute in the list below type:

Redirect 301/ old-page// new-page/

Without regular expressions, all URLs with UTM query string, e.g.,/ old-page? utm_source=facebook.com (which is common since URLs are used to be shared over a social network), would end up as 404s.

Even/ old-page without a routing slash “/” would end up as a 404.

Redirect All Except

Let’s say we have a lot of URLs like/ category/old-subcategory -1/,/ category/old-subcategory -2/,/ category/final-subcategory/ and want to combine all subcategories into/ category/final-subcategory/. We require the “all except” rule here.

RewriteCond % REQUEST_URI!/ category/final-subcategory/ RewriteCond % REQUEST_FILENAME!-f RewriteRule ^(classification/)./ category/final-subcategory/ [R=301, L] Here, we wish to redirect all under/ category/ on the third line except if it is/ category/final-subcategory/ on the fourth line. We also have the “!-f” guideline on the 2nd line, overlooking any file like images, CSS, or JavaScript files.

Otherwise, if we have some properties like “/ category/image. jpg,” it will likewise be redirected to “/ final-subcategory/” and cause an image break.

Directory Modification

You can utilize the guideline listed below if you did a category restructuring and wish to move everything from the old directory to the new one.

RewriteRule ^ old-directory$/ new-directory/ [R=301, NC, L] RewriteRule ^ old-directory/(. *)$/ new-directory/$1 [R=301, NC, L] I used $1 in the target to inform the server that it should remember everything in the URL that follows/ old-directory/ (i.e.,/ old-directory/subdirectory/) and pass it (i.e., “/ subdirectory/”) onto the destination. As a result, it will be redirected to/ new-directory/subdirectory/.

I utilized 2 guidelines: one case without any routing slash at the end and the other one with a tracking slash.

I could combine them into one rule using (/? |. *)$ RegExp at the end, however it would cause issues and add a “//” slash to the end of the URL when the asked for URL without any tracking slash has a question string (i.e., “/ old-directory? utm_source=facebook” would be redirected to “/ new-directory//? utm_source=facebook”).

Remove A Word From URL

Let’s state you have 100 URLs on your site with the city name “Chicago” and wish to remove them.

For the URL http://yourwebiste.com/example-chicago-event/, the redirect rule would be:

RewriteRule ^(. *)-chicago-(. *) http://% SERVER_NAME/$1-$2 [NC, R=301, L] If the example URL remains in the kind http://yourwebiste.com/example/chicago/event/, then the redirect would be: RewriteRule ^(. *)/ chicago/(. *) http://% SERVER_NAME/$1/$2 [NC, R=301, L] Set A Canonical URL

Having canonical URLs is the most important part of SEO.

If missing out on, you may endanger your site with duplicate content issues due to the fact that search engines deal with URLs with “www” and “non-www” versions as different pages with the same content.

For that reason, you need to guarantee you run the site only with one variation you pick.

If you wish to run your website with the “www” version, use this guideline:

RewriteCond % HTTP_HOST ^ yourwebsite.com [NC] RewriteRule ^(. *)$ http://www.yourwebsite.com/$1 [L, R=301] For a “non-www” variation: RewriteCond % HTTP_HOST ^ www.yourwebsite.com [NC] RewriteRule ^(. *)$ http://yourwebsite.com/$1 [L, R=301] Trailing slash is also part of canonicalization because URLs with a slash at the end or without are also dealt with in a different way. RewriteCond % !-f RewriteRule ^(. * [^/]$/$1/ [L, R=301] This will make certain the/ example-page is redirected to/ example-page/. You may select to get rid of the slash instead of including then you will require the other guideline below: RewriteCond % !-d RewriteRule ^(. *)/$/$1 [L, R=301]HTTP To HTTPS Redirect

After Google’s initiative to encourage website owners to utilize SSL, moving to HTTPS is one of the typically utilized redirects that practically every site has.

The reword rule listed below can be utilized to require HTTPS on every site.

RewriteCond % ^ yourwebsite.com [NC, OR] RewriteCond % ^ www.yourwebsite.com [NC] RewriteRule ^(. *)$ https://www.yourwebsite.com/$1 [L, R=301, NC] Using this, you can combine a www or non-www variation reroute into one HTTPS redirect guideline.

Redirect From Old Domain To New

This is also one of the most used redirects when you decide to rebrand and need to change your domain. The rule listed below reroutes old-domain. com to new-domain. com.

RewriteCond % ^ old-domain. com$ [OR] RewriteCond % ^ www.old-domain.com$ RewriteRule (. *)$ http://www.new-domain.com/$1 [R=301, L] It uses two cases: one with the “www” version of URLs and another “non-www” because any page for historical reasons may have incoming links to both variations.

Most website owners use WordPress and might not require a.htaccess file for redirects but use a plugin rather.

Handling redirects using plugins might be slightly different from what we went over above. You might need to read their documentation to manage RegExp correctly for the particular plugin.

From the existing ones, I would recommend a free plugin called Redirection, which has lots of criteria to manage redirect guidelines and lots of helpful docs.

Redirect Best Practices

1. Don’t Reroute All 404 Broken URLs To The Homepage

This case often occurs when you are too lazy to investigate your 404 URLs and map them to the suitable landing page.

According to Google, they are still all treated as 404s.

If you have too many pages like this, you must think about producing gorgeous 404 pages and engaging users to browse further or find something besides what they were trying to find by displaying a search option.

It is strongly suggested by Google that redirected page material ought to be comparable to the old page. Otherwise, such a redirect may be considered a soft 404, and you will lose the rank of that page.

2. Get Mobile Page-Specific Reroutes Right

If you have various URLs for desktop and mobile sites (i.e., “example.com” for desktop and “m.example.com” for mobile), you must make sure to redirect users to the suitable page of the mobile version.

Correct: “example.com/sport/” to “m.example.com/sport/”
Wrong: “example.com/sport/” to “m.example.com”

Also, you need to make sure that if one page is 404 on the desktop, it should also be 404 on mobile.

If you have no mobile version for a page, you can avoid rerouting to the mobile version and keep them on the desktop page.

3. How To Utilize Meta Refresh

It is possible to do a redirect utilizing a meta revitalize tag like the example listed below:

If you place this tag in/ old-page/, it will reroute the user right away to/ new-page/.

Google does not forbid this redirect, however it does not suggest utilizing it.

According to John Mueller, online search engine may not be able to recognize that kind of redirect appropriately. The exact same is also true about JavaScript redirects.

4. Avoid Redirect Chains

This message displays when you have a wrong routine expression setup and ends up in a boundless loop.

Screenshot by author, December 2022 Usually, this takes place when you have a redirect chain. Let’s say you redirected page 1 to page 2 a long period of time back. You might have forgotten that

page 1 is redirected and decided to reroute page 2 to page 1 again. As an outcome, you will wind up with a guideline like this: RewriteRule ^ page1/ page2 [R

=301, NC, L] RewriteRule ^ page2/ page1 [R=301, NC, L] This will produce a boundless loop and produce the mistake revealed above. Conclusion Knowing what

redirects are and which scenario requires a specific status code is essential to


web pages effectively. It’s a core part of understanding SEO. Numerous circumstances need accurate knowledge of redirects, such as migrating a site to a brand-new domain or developing a temporary holding page URL for a web page that will return under its normal URL. While a lot is possible with a plugin, plugins can be misused without correctly comprehending when and why to use a particular

sort of redirect. More Resources: Featured Image: