Rewriting Url's
The page describes how CMS makes urls SEO-friendly.
Terminology
Rewrite
Rewrite means that the address that the user typed in is unchanged. However, the page that is displayed has a different physical address.
Forward
Forward means that the address that the user typed in is changed to the forwarded address in the Rewrite Rule.
References
Xml Syntax
The Xml file for rewrite rules is explained on
xml for Rewrite Rules.
Editing the Xml File
There is a
Web Part for editing the Rewrite Rules xml file.
Rewrite Rules
There are a number of Rewrite Rules that can be selected by the user. These include:
- Normal
- Absolute
- Authority
- PathAndQuery
- PrefixMatch
Normal
Normal is the
normal case for rewriting urls for the website. e.g. a Cold Fusion site that is turned into an asp.net website has a lot of urls that look like 'http://mysite.ca/home.cfm'. Users have these pages bookmarked, so it is important to be able to forward this url to the new home page, e.g. 'http://mysite.ca/home.aspx'. The site owner may decide that he wants to 'future-proof' the site by making the new home page 'http://mysite.ca/home.html'.
Note: the 'http://mysite.ca/home.html' address is what the user should see in the browser. In the future, this page is bookmarked.
The rules involved in this example are:
Rule 1. Forward the old 'cfm' page to the new 'html' page.
Rule 2. Rewrite the 'html' page to the physical 'aspx' page.
Absolute
Example: Forward to another domainAbsolute is used when a specific page is forwarded to another domain.
Authority
Example: Make site unavailableAuthority is useful for redirecting the entire site to a specific page, e.g. Make the site unavailable to the public.
PathAndQuery¶
Normally, the query part of the address is added onto the rewritten url. PathAndQuery is used when the query part of the address should be changed. e.g. the old page of the site, '/index1.aspx?page=Charles', is redirected to a new page: '/Charles.html'.
PrefixMatch
Example: Subdomain mappingSubdomain mapping is very useful when the site owner wants to provide multiple subdomains within the same website. Prefix Match is used to rewrite the subdomain page to the physical page.
The rules involved in this example are:
Rule 1: Rewrite the 'http://joe.mysite.ca/joe' to 'http://www.mysite.com/joe'.
Rule 2: Rewrite the 'http://joe.mysite.ca' to 'http://www.mysite.com/joe'.
Order is important in defining rules. Start with the specific rules and work down to the general rules.
Example: Map domain to wwwPrefixMatch is also used to forward the domain to the www subdomain of the website. This is important for because mysite.com and www.mysite.com are two different sites when viewed by web analytics and SEO.
The rule is written as: Redirect 'http://mysite.ca' to 'http://www.mysite.ca'.
NotesThere may some work that the ISP has to do to support this. In the case of LFC Hosting, they forward all subdomains to the site domain. (In their network,) This requires that they setup a static IP Address for the site domain then add the DNS wildcard entry. Cost is $5/month.