Redirects - 301 and 302 Redirection for SEO


Redirects - 301 and 302 Redirection for SEO

What is a Redirect?

A redirect happens when someone asks for a specific page but gets sent to a specific page. If the asked page is broken then the redirects send visitors and crawlers to a more relevant page. So, redirection is the process of forwarding one URL to a different URL. There are many types of redirects but the three most used redirects are 301, 302, & meta refresh. 

301 redirect means the URL is moved permanently to another address & it is most recommended for SEO. The second redirect is 302 which means “Found” or “Moved Temporarily”. And the third and last one is Meta Refresh, in which the browser automatically refreshes a page after a given time interval. Let us go in-depth and understand more about these Redirects. 

301 Moved Permanently 

A 301 redirect is a permanent redirect that passes between 90-99% of link equity to the redirected page. 301 refers to the HTTP status code for this type of redirect. The 301 redirect is the best method for implementing redirects on a website. 

In simple terms, a 301 redirect tells the browser. “This page has moved permanently. This is the new location and we don’t intend on moving it back”. To which the browser responds and sends the user the redirected page or link. 

302 Found (HTTP 1.1) / Moved Temporarily (HTTP 1.0)

The internet runs on a protocol called Hypertext Transfer Protocol(HTTP) which tells how URL works. It has two major versions, 1.0 and 1.1, in the first one the URL is moved temporarily and this is changed in version 1.1 to mean found. 

307 Moved Temporarily (HTTP 1.1 only)

A 307 redirect is a successor of the 302 redirects. Major crawlers treat it as a 302 redirect. The exception to this is when content is really moved only temporarily (such as during maintenance) the browser considers this as 3.1. Since it's essentially impossible to determine whether or not the search engines have identified a page as compatible, it is generally best to use a 302 redirect for content that has been temporarily moved.

Meta Refresh 

Meta Refresh is not used and is not recommended in SEO techniques. They can be recognized with 5-second rules. If you are not redirected within 5 seconds, then click here. They have some ranking power but are not used in SEO due to poor stability and loss of the link. 

SEO Best Practice

It’s common to redirect URLs to another. While doing these you need to observe the best practices in order to maintain SEO value. For instance, you want people who visit page 1 to go to page 2 instead. 

There are multiple ways in which it can be done, but in general and the most common practice is using  301 redirects. The 301 redirect is preferable for both users & search engines. With 301 it indicates to both search engine and browser that the page is moved permanently. Search engines understand that only the page location has changed, but that content or an updated version can be found at the new URL. 

While moving a page to a new URL, the search engine will take some time to discover the 301, in recognizing it, & give credit to the new age with rankings and traffic. This process can be lengthier if search engine spiders rarely visit the given web page, or if the new URL doesn't properly resolve. Using other redirects like 302 and meta refreshes but it won't be successful like check 301 redirects. The only time these redirects are good alternatives is if a webmaster purposefully doesn't want to pass link equity from the old page to the new.

301 Redirects in Apache


When you do the redirection,  the redirection had to accommodate several file and folder name changes and had to be done with 301 redirects in order to be search engine-friendly. When we were redirecting to our own dedicated server then we wanted it to be accessed as it’s own domain server rather than a subdirectory of 


The simplest approach to do this would have been to add 301 redirects to the PHP code that powered using PHP's header function. Utilizing the power of the apache module mod_rewrite, however, the developers realized they could match specific patterns for entire folders and redirect them to their new URLs without having to go through every PHP script.


In order for this to work, a web server needs to have the Apache module mod_rewrite installed. Most Apache installations will have mod_rewrite installed by default. 10seo's original server ran the Linux distribution FreeBSD and mod_rewrite was included by default. 

Regular Expressions

Ordinary articulations are a significant aptitude to learn for the two developers and frameworks managers. To divert URLs as per the models right now is imperative to comprehend the nuts and bolts of utilizing regexes. Coming up next is a rundown of the characters and administrators that are utilized in the regexes portrayed right now:

  • .Period-matched anything

  • * Asterisk-matches zero or other preceding characters

  • + sign matches one or more of the preceding character

  • () Parentheses - enclosing a value in parenthesis will store what was matched in a variable to be used later; this is also referred to as a backreference. 

  • (value1|value2) - enclosing two or more values in parenthesis and separating them with a pipe character is the equivalent of saying: "matching value1 OR value 2"

Redirecting Specific Files and Folders From one Domain to Another


Redirect: http:// TO:/ somefile.php


Add the following directive to the applicable file

RedirectMatch 301/seo/(.*) /$1

Redirecting Canonical Hostnames

We at 10seos needed to redirect any requests that do not start with to make sure they included the www. They did this not only because it looks better, but to avoid common canonicalization errors.







http://#####replaceparse27####... class="bottom0">Solution

Add the following directive:

<pre>RewriteCond %{HTTP_HOST} *!^www*.10seos\.org [NC]RewriteRule (.*)$1 [L,R=301]</pre>


This directive tells apache to examine the host the visitor is accessing, and if it does not equal, to redirect to The exclamation point (!) in front of negates the comparison, saying, “If the host IS NOT, then perform RewriteRule.” In our case, RewriteRule redirects them to while preserving the exact file they were accessing in a back-reference.

Redirecting Without Preserving the Filename

Several files that existed on the old server were no longer present on the new server. Instead of preserving the file names in the redirection (which would result in a 404 not found error on the new server), the old files needed to be redirected to the root URL of the new domain.




Add the following directive:

<pre>RedirectMatch 301 /seo/someoldfile.php &... class="bottom0">

Redirecting the GET String

Some of the PHP scripts had different names but the GET string stayed the same. The GET string is the set of characters that come after a filename in the URL and are used to pass data to a web page. An example of a GET string in the URL /myfile.php?this=that foo=bar would be ?this=that foo=bar.

Redirect http://www.10seos/seo/c...


http://#####replace part 37####... class="bottom0">Solution:

Add the following directive:

<pre>RedirectMatch 301 /seo/categorydetail.php(.*) http:// class="bottom0">Explanation:

Once again the regular expression (.*) tells apache to match zero or more of any character and save it as the back-reference $1. Since there is a $1 after /seo/categorydetail.php, it will now redirect the get string to this new PHP file.

Redirecting While Changing File Extensions

In the original scenario, there was a folder of files on the old server that was mixed HTML and PHP. On the new server, these files were all PHP and needed to redirect logic to change the old URLs to this new extension.


To: http://www.s


To: www.

http://#####replace part 41####... class="bottom0">Solution:

Add the following directive:

<pre>RedirectMatch 301 /seo/guide/(.*)\.(php|html) http://www. class="bottom0">

With mod_rewrite and a little regular expression magic, the original developers at 10seos developed a set of simple rules of redirecting web pages. By using 301 redirects, they did this in a way that was search engine-friendly. So, use check for redirects to redirect the and pages to another site. 

Directory listing counter is continuously increasing, be a part of it to gain the advantages, 9457 Companies are already listed.

Skype: virtuousreviews

We use cookies to offer you a better browsing experience, analyze site traffic, personalize content, and serve targeted advertisements. If you continue to use this site, you consent to the placement and use of cookies. We will handle your contact details in line with our Privacy Policy