URL Reroutes For SEO: A Technical Guide

Posted by

Redirects for SEO ought to be utilized correctly since they impact how websites are crawled and indexed by Google.

While many people think of redirects as an internet detour sign, a lot more is happening, and it’s remarkably satisfying to discover.

Keep reading for a thorough summary of redirects and the correct application for technical SEO.

What Is A Redirect?

Website redirects tell internet browsers and online search engine details about a URL and where to find the webpage.

A URL redirect includes code carried out to a specific URL, or a group of URLs so that the user (or online search engine) is sent to a different page to the actual 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 main factors to utilize redirects are:

  • A specific page or whole domain has actually been moved (URL altered).
  • To enable the usage of URL shorteners or ‘pretty URLs.’
  • Site migration (e.g., HTTP to HTTPS).

For SEO purposes, URL redirects are important since they:

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

Redirects can be implemented on a group or domain-wide basis but typically need to be set on an individual basis to avoid concerns.

When using RegEX for group redirects, it can have unforeseen results if your reasoning isn’t perfect!

Types Of Redirects

There are three main types of redirects:

  • Meta Refresh redirects are set at the page level however are normally not advised for SEO functions. There are two types of meta redirect: postponed which is viewed as a short-term redirect, and instant, which is viewed as an irreversible redirect.
  • Javascript reroutes are likewise set on the customer side’s page and can trigger SEO problems. Google has actually mentioned a choice for HTTP server-side redirects.
  • HTTP redirects are set server-side and the very best method for SEO functions– we covered in-depth listed below.

What Is A HTTP Action Status Code?

Browsers and online search engine spiders like GoogleBot are called user representatives.

When a user representative tries to access a website, what occurs is that the user agent makes a request, and the website server problems an action.

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

In the scenario where a user agent like GoogleBot demands a URL, the server offers a reaction.

For example, if the ask for a URL is successful, the server will supply a reaction code of 200, which means the ask for a URL succeeded.

So, when you think about a GoogleBot reaching a website and attempting to crawl it, what’s occurring is a series of requests and reactions.

HTTP Reroutes

An HTTP redirect is a server response to request a URL.

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

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

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

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

So, a 301 and a 302 redirect is more than a web roadway sign that says, “Go here, not there.”

3XX Series Of Status Codes

Redirects are more than just the 2 status codes everybody is familiar with, the 301 and 302 response codes.

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

These are the various sort of redirects readily available for usage:

  • 300 Several Choices.
  • 301 Moved Completely.
  • 302 Found.
  • 303 See Other.
  • 304 Not Modified.
  • 305 Usage Proxy.
  • 306 (Unused).
  • 307 Short-lived Redirect.
  • 308 Permanent Redirect.

A few of the above status codes have not been around as long and might not be used. So, before utilizing any redirect code aside from 301 or 302, make certain that the desired user representative can analyze it.

Because GoogleBot uses the current version of Chrome (called a headless browser), it’s easy to check if a status code is compatible by inspecting if Chrome recognizes the status code with an internet browser compatibility list.

For SEO, one should stick to using the 301 and 302 response codes unless there is a specific reason to utilize among the other codes.

301: Moved Completely

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

The 301 redirect suggests to a user representative that the URL (sometimes described as a target resource or just resource) was changed to another location and that it should utilize the new URL for future demands.

As mentioned earlier, there is more details as well.

The 301 status code also suggests to the user agent:

  • Future ask for the URL should be made with the brand-new URL.
  • Whoever is making the demand needs to update their links to the new URL.
  • Subsequent requests can be altered from GET to POST.

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

“Note: For historical factors, a user representative MAY change the request technique from POST to GET for the subsequent demand. If this behavior is unwanted, the 308 (Permanent Redirect) status code can be utilized instead.”

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

Before making a modification, you need to take care when using a 301 redirect. The 301 redirects should only be used when the modification to a new URL is permanent.

The 301 status code should not be utilized when the modification is temporary.

Furthermore, if you change your mind later on and go back to the old URL, the old URL may not rank any longer and might take some time to gain back the rankings.

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

302: Found

The main point to understand about the 302 status code is that it’s useful for circumstances where a URL is momentarily altered.

The meaning of this response code is that the URL is briefly at a various URL, and it is suggested to utilize the old URL for future requests.

The 302 redirect status code likewise includes a technical caution related to GET and Post:

“Keep in mind: For historic factors, a user representative MAY change the demand approach from POST to GET for the subsequent request. If this habits is undesirable, the 307 (Short-term Redirect) status code can be used rather.”

The recommendation to “historical reasons” may describe old or buggy user representatives that may change the request approach.

307: Temporary Redirect

A 307 redirect implies the asked for URL is briefly moved, and the user agent ought to utilize the original URL for future requests.

The only distinction in between a 302 and a 307 status code is that a user agent need to request the new URL with the exact same HTTP demand used to request the initial URL.

That indicates if the user representative requests the page with a GET request, then the user agent need to utilize a GET ask for the brand-new momentary URL and can not use the POST request.

The Mozilla documentation of the 307 status code describes it more clearly than the main documentation.

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

This has the same semantics as the 302 Found HTTP response code, with the exception that the user agent must not change the HTTP approach used: if a POST was used in the first demand, a POST needs to be utilized in the second request.”

Besides the 307 status code requiring subsequent demands to be of the exact same kind (POST or GET) which the 302 can go either way, whatever else is the exact same in between the 302 and the 307 status codes.

302 Vs. 307

You might handle a redirect by means of server config files.htaccess on Apache, example.conf file on Nginx or by means of plugins if you are using WordPress.

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

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

(You can read about symlinks here.)

On Nginx servers, it will look like this:

reword ^/ oldfolder// newfolder/ long-term;

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

For example:

  • Servers status code of redirect: “301 ″ vs. “irreversible.”
  • Action command: “RedirectMatch” vs. “rewrite.”

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

On Apache, guarantee that mod_rewrite and mod_alias modules (responsible for dealing with redirects) are enabled on your server.

Considering that the most widely spread out server type is Apache, here are examples for.htaccess apache files.

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

Choices +FollowSymlinks RewriteEngine on

Read the official paperwork to learn more about the RewriteEngine.

To understand the examples below, you might refer to the table listed below on RegExp essentials.

* absolutely no or more times
+ Several times
. any single character
? No or one time
^ Start of the string
$ End of the string
| b OR operadn” |” a or b
(z) keeps in mind the match to be used when calling $1

How To Produce Redirects

How To Produce A Redirect For A Single URL

The most typical and widely used type of redirect is when erasing pages or changing URLs.

For example, say you altered 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 between the 2 techniques is that the very first utilizes the Apache mod_rewrite module, and the 2nd usages mod_alias. It can be done utilizing both approaches.

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

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

The following URLs will match and be directed to a 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 new one. If we utilize redirect in the following kind:

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

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

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

Redirect All Except

Let’s state we have a lot of URLs like/ category/old-subcategory -1/,/ category/old-subcategory -2/,/ category/final-subcategory/ and wish to merge all subcategories into/ category/final-subcategory/. We need 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 want to redirect all under/ category/ on the 3rd line other than if it is/ category/final-subcategory/ on the fourth line. We also have the “!-f” guideline on the 2nd line, ignoring any file like images, CSS, or JavaScript files.

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

Directory site Change

You can utilize the guideline below if you did a category restructuring and want to move everything from the old directory site to the brand-new one.

RewriteRule ^ old-directory$/ new-directory/ [R=301, NC, L] RewriteRule ^ old-directory/(. *)$/ new-directory/$1 [R=301, NC, L] I utilized $1 in the target to tell the server that it should remember whatever 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 rerouted to/ new-directory/subdirectory/.

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

I could integrate them into one rule using (/? |. *)$ RegExp at the end, but it would cause problems and add a “//” slash to the end of the URL when the requested URL without any tracking slash has a query string (i.e., “/ old-directory? utm_source=facebook” would be rerouted to “/ new-directory//? utm_source=facebook”).

Remove A Word From URL

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

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

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

Having canonical URLs is the most important part of SEO.

If missing, you may threaten your site with replicate content issues since online search engine treat URLs with “www” and “non-www” versions as different pages with the very same content.

For that reason, you should ensure you run the website just with one version you pick.

If you wish to run your site with the “www” version, utilize this rule:

RewriteCond % ^ yourwebsite.com [NC] RewriteRule ^(. *)$ http://www.yourwebsite.com/$1 [L, R=301] For a “non-www” version: RewriteCond % ^ www.yourwebsite.com [NC] RewriteRule ^(. *)$ http://yourwebsite.com/$1 [L, R=301] Trailing slash is also part of canonicalization given that URLs with a slash at the end or without are also treated in a different way. RewriteCond % !-f RewriteRule ^(. * [^/]$/$1/ [L, R=301] This will make sure the/ example-page is rerouted to/ example-page/. You might pick to remove the slash instead of including then you will need the other rule listed below: RewriteCond % REQUEST_FILENAME!-d RewriteRule ^(. *)/$/$1 [L, R=301]HTTP To HTTPS Redirect

After Google’s effort to encourage site owners to utilize SSL, migrating to HTTPS is one of the typically used redirects that practically every site has.

The reword guideline listed below can be used to force HTTPS on every website.

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

Redirect From Old Domain To New

This is likewise among the most used redirects when you decide to rebrand and need to alter your domain. The guideline listed below redirects old-domain. com to new-domain. com.

RewriteCond % ^ old-domain. com$ [OR] RewriteCond % HTTP_HOST ^ www.old-domain.com$ RewriteRule (. *)$ http://www.new-domain.com/$1 [R=301, L] It utilizes 2 cases: one with the “www” variation of URLs and another “non-www” since any page for historic factors might have incoming links to both versions.

A lot of site owners utilize WordPress and might not require a.htaccess apply for redirects however use a plugin instead.

Dealing with redirects using plugins may be slightly different from what we went over above. You may need to read their documents to deal with RegExp properly for the specific plugin.

From the existing ones, I would advise a totally free plugin called Redirection, which has numerous parameters to control redirect rules and numerous beneficial docs.

Reroute Finest Practices

1. Do not Reroute All 404 Broken URLs To The Homepage

This case typically 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 dealt with as 404s.

If you have a lot of pages like this, you should think about producing gorgeous 404 pages and engaging users to search more or find something besides what they were searching for by showing a search choice.

It is strongly suggested by Google that rerouted page content should be equivalent to the old page. Otherwise, such a redirect might be considered a soft 404, and you will lose the rank of that page.

2. Get Mobile Page-Specific Reroutes Right

If you have different URLs for desktop and mobile websites (i.e., “example.com” for desktop and “m.example.com” for mobile), you should ensure to reroute 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 have to guarantee that if one page is 404 on the desktop, it must also be 404 on mobile.

If you have no mobile version for a page, you can prevent redirecting to the mobile variation and keep them on the desktop page.

3. How To Use Meta Refresh

It is possible to do a redirect using a meta refresh tag like the example listed below:

If you insert this tag in/ old-page/, it will reroute the user instantly to/ new-page/.

Google does not prohibit this redirect, but it does not suggest utilizing it.

According to John Mueller, online search engine might not have the ability to acknowledge that kind of redirect properly. The same is likewise true about JavaScript redirects.

4. Avoid Redirect Chains

This message displays when you have an incorrect regular expression setup and ends up in an unlimited loop.

Screenshot by author, December 2022 Typically, this happens when you have a redirect chain. Let’s state you rerouted page 1 to page 2 a very long time earlier. You may have forgotten that

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

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

redirects are and which situation requires a specific status code is fundamental to


web pages appropriately. It’s a core part of understanding SEO. Many situations need accurate understanding of redirects, such as migrating a website to a new domain or developing a momentary holding page URL for a web page that will return under its regular URL. While so much is possible with a plugin, plugins can be misused without correctly comprehending when and why to utilize a specific

sort of redirect. More Resources: Featured Image: