Url Redirection


Hello Friends

Redirection is the procedure of sending one Url to an alternate Url. There are three fundamental sorts of redirects: 301, 302, and meta invigorate. 

Sorts of Redirects 

  • 301, "Moved Permanently"—prescribed for Seo 
  • 302, "Found" or "Moved Temporarily" 
  • 307 Moved Temporarily
  • Meta Refresh 

What is a Redirect ? 

A redirect is a route to send both clients and web crawlers to an alternate Url from the one they initially asked. Beneath are portrayals of a portion of the regularly utilized sorts of redirects. 

301 Moved Permanently 

A 301 redirect is a lasting redirect which passes between 90-99% of connection squeeze (standing power) to the redirected page. 301 implies the Http status code for this sort of redirect. In generally occasions, the 301 redirect is the best technique for actualizing redirects on a site. 

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

A 302 redirect is a provisional redirect. It passes 0% of connection squeeze (standing power) and, as a rule, ought not be utilized. The Internet runs on an order called Hypertext Transfer Protocol (Http) which manages how Urls function. It has two major forms, 1.0 and 1.1. In the first form, 302 implied the status code "Moved Temporarily." This was modified in rendition 1.1 to mean "Found." 

307 Moved Temporarily (Http 1.1 Only) 

A 307 redirect is the Http 1.1 successor of the 302 redirect. While the major crawlers will treat it like a 302 in a few cases, it is best to utilize a 301 for very nearly all cases. The special case to this is when substance is truly moved just for a time, (for example throughout upkeep) And the server has been recognized by the web search tools as 1.1 perfect. Since its basically difficult to verify whether the internet searchers have distinguished a page as good, it is for the most part best to utilize a 302 redirect for substance that has been for a short time moved. 

Meta Refresh 

Meta invigorates are a sort of redirect executed on the page level instead of the server level. They are ordinarily slower, and not a proposed Seo strategy. They are generally regularly connected with a five-second countdown with the content "If you are not redirected in five seconds, click here." Meta revives do pass some connection juice, however are not prescribed as a Seo plan because of unfortunate convenience and the misfortune of connection squeeze passed. 

Seo Best Practice 

It is normal practice to redirect one Url to an alternate one. The point when doing this, it is discriminating to watch best practices with a specific end goal to keep up Seo esteem. 

The primary regular case of this happens with a straightforward situation: a Url that should redirect to a different location for all time. 


There are various choices for doing this, yet when all is said in done, the 301 redirect is ideal for both clients and web search tools. Serving a 301 demonstrates to both programs and web search tool bots that the page has moved for all time. Internet searchers decipher this to imply that not just has the page modified area, however that the substance or a redesigned form of it—could be discovered at the new Url. The motors will convey any connection weighting from the definitive page to the new Url, as beneath: 

Be cognizant that when moving a page from one Url to an alternate one, the web indexes will take a step back to uncover the 301, distinguish it, and acknowledge the new page for the rankings and trust of its forerunner. This procedure could be lengthier if web search tool bugs once in a while visit the given site page, or if the new Url doesn't legitimately resolve. 

Different alternatives for redirection, for example 302s and meta revives, are unfortunate substitutes, as they for the most part won't pass the rankings and web crawler quality like a 301 redirect will. The main time these redirects are exceptional plan B is if a webmaster deliberately would like to pass interface squeeze from the old page to the new. 


Exchanging substance comes to be more unpredictable when a whole site progressions its area or when content moves from one area to a different one. Because of ill-use by spammers and suspicion by the web crawlers, 301s between areas here and there require more time to be fittingly spidered and checked. For increasingly on moving locales, see Achieving a Seo-Friendly Domain Migration: The Infographic. 

301 Redirects in Apache 

Issue: 

A while ago when we started our first site, seocutts.com, it was had at www.socengine.com/seo/ instead of without help from anyone else area. The point when the definitive artists were moving seocutts.com to its own particular committed server, they needed it to be entered as its own particular realm as opposed to as a subdirectory of socengine.com. They required guests entering anything in www.socengine.com/seo/ to be redirected to www.seocutts.com. The redirection had to suit numerous index and organizer name updates and must be finished with 301 redirects with a specific end goal to be web crawler agreeable. They additionally would have done well to send http://seocutts.com, too, or tasteful purposes and to maintain a strategic distance from canonicalization failures. 

Result: 

The least complex methodology to do this might have been to add 301 redirects to the Php code that controlled seocutts.com utilizing Php's header capacity. Using the force of the apache module mod_rewrite, on the other hand, the planners acknowledged they could match particular examples for whole organizers and redirect them to their new Urls without needing to face each Php script. 

Establishment: 

In place for this to function, a web server ought to have the apache module mod_rewrite instituted. 

Generally apache establishments will have mod_rewrite instituted by default. Seomoz's unique server ran the Linux dissemination Freebsd and mod_rewrite was incorporated by default. To verify whether the module is commissioned, a designer can verify it is working by adding the accompanying line to the apache design index or to an appropriate .htaccess index: 

RewriteEngine On 

Setting 
The mod_rewrite module works in for every server setting or in for every catalog setting. 

The for every server setting requires that a planner must alter the apache setup index, httpd.conf. The for every catalog setting utilization .htaccess records that exist in every envelope a client needs to design. Assuming that a webmaster can't access httpd.conf, they will utilize .htaccess indexes. 

Customary Expressions (otherwise known as Regexes) 
From wikipedia.org

A customary outflow is a string that portrays or matches a set of strings, consistent with certain punctuation tenets. General outflows are utilized by numerous message editors and utilities to pursuit and control figures of content dependent upon certain examples. 

Normal articulations are a profitable ability to study for both programmers and frameworks overseers. To redirect Urls consistent with the cases in this archive, it is vital to grasp the nuts and bolts of utilizing regexes. The accompanying is a record of the characters and administrators that are utilized as a part of the regexes portrayed in this archive: 

  • . Period–matches anything 
  • * Asterisk–matches zero or a greater amount of the first characters 
  • + Plus sign–matches one or a greater amount of the first character 
  • ( ) Parenthesis–enclosing a quality in bracket will store what was matched in a variable to be utilized later; this is additionally implied as a back-reference 
  • (value1|value2)–enclosing two or more qualities in enclosure and dividing them with a channel character is what might as well be called maxim: "matching value1 Or value2" 

Redirecting Specific Files and Folders from one Domain to Another 

The definitive designers at Moz required redirection from the old server to the new unified with the filenames protected. 

Sample 

Redirect: http://www.socengine.com/seo/somefile.php To: /somefile.php 

Result 

Add the accompanying directive to the pertinent index on socengine.com's server: 

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

Clarification 

The standard declaration /seo/(.*) advises apache to match the seo envelope accompanied by zero or a greater amount of any characters. Encompassing the .* in enclosure advises apache to spare the matched string as a back-reference. This back-reference is put at the closure of the Url that was controlled to, hence, $1. 

Redirecting Canonical Hostnames 

The definitive designers at Moz would have done well to redirect any demands that don't begin with www.seocutts.com to verify they incorporated the www. They did this not just since it looks better, yet to maintain a strategic distance from regular canonicalization blunders. 

Redirect: http://seocutts.com/ 
To: http://www.seocutts.com/ 

Redirect: http://mail.seocutts.com/ 
To: http://www.seocutts.com 

Redirect: http://seocutts.com/somefile.php 
To: http://www.seocutts.com/somefile.php 

Result 
Include the accompanying directive: 

Rewritecond %{http_host} *!^www*.seomoz\.org [nc] 
Rewriterule (.*) http://www.seocutts.com/$1 [l,r=301] 

Clarification 

This directive advises apache to analyze the host the guest is entering, and provided that it doesn't equivalent www.seocutts.com, to redirect to www.seocutts.com. The outcry focus (!) before www.seocutts.com discredits the correlation, platitude, "If the host Is Not www.seocutts.com, then perform Rewriterule." For our situation Rewriterule redirects them to www.seocutts.com while saving the accurate document they were gaining entrance to in a back-reference. 

Redirecting Without Preserving the Filename 

A few documents that existed on the old server were no long introduce on the new server. In place of safeguarding the index names in the redirection (which might bring about a 404 not discovered lapse on the new server), the old documents would have done well to be redirected to the root Url of the new realm. 

Redirect: http://www.socengine.com/seo/someoldfile.php 
To: http://www.seocutts.com/ 

Result: 

Include the accompanying directive: 

Redirectmatch 301 /seo/someoldfile.php http://www.seocutts.com 

Description: 

Overlooking any bracket, all demands for /seo/someoldfile.php may as well redirect to the root Url of http://www.seocutts.com 

Redirecting the Get String 

A portion of the Php scripts had distinctive names yet the Get string continued through to the end. The Moz visionaries would have done well to redirect the guests to the new Php scripts while saving these Get strings. The Get string is the situated of characters that come after a filename in the Url and are utilized to pass information to a website page. A case of a Get string in the Url /myfile.php?this=that&foo=bar might be "?this=that&foo=bar." 

Redirect: http://www.socengine.com/seo/categorydetail.php?cat_id=12345 
 To: http://www.seocutts.com/artcat.php?cat_id=12345 

Result: 

Include the accompanying directive: 

Redirectmatch 301 /seo/categorydetail.php(.*) http://www.seocutts.com/artcat.php$1 

Illustration: 

By and by the general articulation (.*) advises apache to match zero or a greater amount of any character and recovery 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 index. 

Redirecting While Changing File Extensions 

In the definitive situation there was an envelope of records on the old server that were blended Html and Php. On the new server these indexes were everything Php and required redirect coherence to change the old Urls to this new augmentation. 

Redirect: http://www.socengine.com/seo/guide/anyfile.html 
 To: http://www.seocutts.com/articles/anyfile.php 

Redirect: http://www.socengine.com/seo/guide/anyfile2.php 
 To: http://www.seocutts.com/articles/anyfile2.php 

Result: 
 Include the accompanying directive: 

Redirectmatch 301 /seo/guide/(.*)\.(php|html) http://www.seocutts.com/articles/$1.php 

Illustration: 

(*.) matches zero or a greater amount of any character and recoveries it as the back-reference $1. \.(php|html) advises apache to match a period emulated by either "php" or "html" and recoveries it as the back-reference $2 (in spite of the fact that this isn't utilized within this illustration). Notice the departed period with an oblique punctuation line. This is to guarantee apache does not translate the period as importance "any character" yet rather as a true period. Encasing "php" and "html" in bracket and dividing them with a channel "|" character intends to match either one of the qualities. So provided that it were to say (php|html|css|js|jpg|gif) the regex might match any of the documents with the developments php, html, css, js, jpg, or gif. 

Conclusion 

By outfitting the force of mod_rewrite and a little normal statement enchanting the definitive visionaries at Moz improved a set of straightforward administers for redirecting website pages. By utilizing 301 redirects, they did this in a manner that was pursuit engine–friendly. 


Popular Posts