Xml file for Rewrite Rules
This page explains the syntax of the Xml File for Rewrite Rules.
Xml Syntax for Rewrite Rules
<?xml version="1.0" encoding="utf-8" ?>
<RewriteRules>
<RewriteRule PathType="Normal" LookFor="/home.html" SendTo="/default.aspx" />
<RewriteRule PathType="Absolute" LookFor="http://www.mysite.ca/cmsadmin.html" SendTo="http://admin.mysite.ca/default.aspx" />
<RewriteRule PathType="Authority" LookFor="mysite.ca" SendTo="www.mysite.ca" />
<RewriteRule RedirectPath="true" PathType="PathAndQuery" LookFor="/index1.aspx?page=Charles" SendTo="~/Charles.aspx" />
<RewriteRule PathType="PrefixMatch" LookFor="http://joe.mysite.ca" SendTo="http://www.mysite.ca/joe" />
</RewriteRules>
Notes
The xml file contains:
- Xml Declaration
- List of Rewrite Rules
- Each Rewrite Rule contains:
- PathType: this identifies how the path is interpreted
- LookFor: the incoming path
- SendTo: if the incoming address matches the LookFor url, then this is the path that the page is sent to
- RedirectPath: this attribute is used only when the url is forwarded to a new url. The address on the browser is updated to match the SendTo url.
Note: Multiple rewrite rules can be executed for a page.