Skip to content
webtechnick edited this page Jan 4, 2011 · 26 revisions

Working With Seo Redirects

About

The SEO Redirect tool is used primarily for SEO purposes, but can also be used to redirect your users from a bad url to a good url. You can define rules that when presented with a specific URI where a 404 would normally occur, a redirect will occur instead to a place you define. URI can accept simple wildcards or regular expressions. Each Seo Redirect has a priority and an is_active status that must be turned on for the redirect to work. The redirect tool will grant the user to define very simple or complex redirect rules based on the incoming request, priority gives the ability to grant situational redirects. Below are all the things you need to know in order to start using the Seo Redirect tool.

Admin Panel

Browsing and Managing Redirects

http://www.example.com/admin/seo/seo_redirects

Creating a new Redirect

http://www.example.com/admin/seo/seo_redirects/add

Seo Redirect Fields

URI

  • Incoming URI that a user is requesting that you want to redirect them away from using a 301. Either a relative link following domain (www.example.com) or a regular expression.
  • Regular expression are started and ended with # sign. Please refer to Advanced Redirects for details.

Redirect

  • The URL (relative to the domain preferably) you want the matching URI to redirect to with a 301. This can be an absolute path, relative, or a pattern match (Regular Expression URI only)

Priority

  • The priority to give this redirect rule. In the case of a conflict the redirect rule with LOWER priority number will take the match and run the redirect.

  • Example: /test.asp -> /first_link with Priority 1 Will Overrule /test.asp -> /other_link with Priority 2

Going to /test.asp will redirect the user to /first_link NOT /other_link

Active

  • Toggle the active/deactivate status of this rule.

Types of Redirects

There are two different types of 301 Redirects, basic and advanced.

Basic Redirects

Basic redirects can be Many->One, or One->One redirects. They are simple to implement and understand what is going on. URI and redirects should be relative to the domain. One->One:

  • URI : /library
  • REDIRECT: /guides/common-questions
  • Result: http://www.example.com/library Redirects To http://www.example.com/guides/common-questions

Many->One: Working with Wildcards

By specifying an * at the end of your URI you are allowing the redirect rule to match anything past the specified URI.

  • URI: /website*

  • REDIRECT: /

  • Result: http://example.com/website OR http://example.com/websites-are-fun OR http://www.example.com/website/param/really/long/url Redirects To http://example.com

  • Notice the * denotes anything following /website will match this this redirect rule.

Advanced Redirects

Advanced redirects use regular expressions to see if a redirect matches and then runs a pattern match on the redirect. This allows for far more flexibility but can be a little hard to read/write. Advanced redirects are the only redirect that can handle Many->Many redirects.

All regular expression redirect rules need to start and end (not including optional conditions) with a # sign, otherwise it will be treated as a basic redirect rule.

Advisory Warning: Regular Expressions redirect rules are very powerful but can also be dangerous causing nasty redirect loops and other badness. Proceed with caution.

Note: All Advanced redirects must be approved by IT. Once an advanced redirect is created it is then sent to an IT for approval. Once approved the redirect will take affect. Many->Many: Working with Regular Expressions

  • URI: #(.*)\?from\=sb\-tracked\:(.*)#i

  • Redirect: $1

  • Result: This redirect rule will match any URI with ?form=sb-tracked: on the end of it and redirect it to the same url without ?form=sb-tracked: appended to the end of the URI.

    • Note: the i at the end of the regular expression signifies to be case insensitive.
    • Note: The $1 signifies whatever is found in the first set of () marks.
    • For each set of () in the URI regular expression you will have ${number} to represent what was found in that area to use in your redirect url.
    • In this example, $1 = the part of the URL before the ? and $2 = the value after “tracked:”
  • URI: #/article/([0-9a-zA-Z]*)#

  • Redirect: /guides/$1

  • Result: This redirect rule is basically an alias for /article/ to /guides/ that will maintain the rest of the URI untouched.

Resources

Here are some helpful resources to learn more about using regular expressions: http://www.regular-expressions.info/tutorial.html http://www.zytrax.com/tech/web/regex.htm

Web tool for testing your regular expression: http://www.perlfect.com/articles/regextutor.shtml

Clone this wiki locally