URL Redirections

Follow

URL Redirections allow you to redirect a site visitor from one URL to another.

You can define specific URL Redirections within Agility based on relative or absolute URLs, User Agents and Languages.

You can find URL Redirections in Agility > Settings > Global ContentURL Redirections.


URL Redirections can be critical when you are migrating from an old site to a new one, or simply changing a name of a page and ensuring old links don't result in a Page Not Found (404) error.

The 301 - Permanent HTTP Code ensures that Google and other search engines carry your page rank over from the old page to the new one.

A URL Redirect is comprised of 2 components, Origin and Destination.

URL Redirection – Origin

You can choose a relative or absolute URL (External Link) to act as the Origin URL. For instance http://www.mysite.com/mobile represents an absolute URL, and only full URLs (including that domain) will  be matched, while ~/mobile represents a relative URL and it will be matched to any URL that has that path, regardless of domain.

The User Agents section allows you to choose which User Agents will be matched to trigger the
redirection. Any of the selected User Agents will be used to detect a match.

The Origin Language can be specified to limit this redirection to only be triggered when the user is currently browsing the website in the selected language(s).

Developer NOTE: Origin URLs must be URLs that ASP.NET normally processes. For web forms sites on IIS 6, this means the URL must have an extension with .aspx in it.

If you want to have extensionless URLs as Origin URLS, you must IIS 7 or greater in integrated mode. 

URL Redirection - Destination

The Destination URL can be relative or absolute (External Link), just like the origin. If you specify a relative path, the domain portion of the URL will not change in the user’s browser.

The HTTP Code represents the redirection code that gets sent to the browser. Normally a 301 –
Permanent Code is preferred, since this will tell the browser (or search crawler) that the destination URL has been permanently replaced by the destination URL.

The 302 – Temporary Code means that the destination URL has only temporarily replaced the origin URL.

The destination Language allows you to change the language that the user is browsing the site in when the redirection happens. For instance, you might want to redirect ~/Francais back to the website root (http://www.mysite.com) in French.

Examples

Let’s look at a couple of examples.

Example 1 - Basic Redirect

  • Origin URL: ~/page-a
  • Destination URL: ~/page-b
  • HTTP Code: 301

This will redirect ALL users on ANY domain from ~/page-a to ~/page-b using a permanent redirect. This is the recommended practice of handling cases where a page's name has changed.

Example 2 - Targeting User Agents

  • Origin URL: ~/mobile.aspx
  • User Agents: Mobile Current, Mobile Retro
  • Destination URL: http://m.mysite.com
  • HTTP Code: 301

If the user navigates to http://www.mysite.com/mobile.aspx with a browser that has a User Agent
with iPhone in it, they will be redirected to http://m.mysite.com.

If the user browser to http://www.mysite.com/mobile.aspx with Firefox 4, they will NOT be
redirected. The browser will try to load the page at mobile.aspx.

Example 3 - Targeting Languages

  • Origin URL: http://fr.mysite.com
  • Origin Language: English
  • Destination URL: http://fr.mysite.com
  • Destination Language: French
  • HTTP Code: 302

If the user navigates to http://fr.mysite.com in English, they will be redirected right back to the same URL, but their language will be switched to French. Note we are using a 302 redirect to ensure that a users’ browser doesn’t cache the redirect (this is to ensure the language gets set to French every time before the redirect is made).

Example 4 - Wildcard Redirects

  • Origin URL: http://www.mysite.com*
  • Origin Language: All
  • Destination URL: http://mysite.com*
  • Destination Language: All

In this example, we are using a wildcard redirect to redirect all traffic (to all pages) from the
www.mysite.com domain to the mysite.com domain. For example a request to
http://www.mysite.com/contact-us will be redirected to http://mysite.com/contact-us. We are using a 301 permanent redirect here to set our primary domain name.

0 out of 0 found this helpful

Comments

0 comments

Please sign in to leave a comment.