How to achieve Url Rewriting/Redirection
Hi All,
I need to rewrite/redirect urls for my Sitefinity 5 website to these formats.
Example:
1. http://test.net/default.aspx to http://test.net/en/default
2. test.net/.../default.aspx to http://test.net/en/efault
The site should support multiple languages.
If the language selected is Chinese, the url for home page will be
test.net/.../default-zh.aspx.
3. test.net/.../default-zh.aspx to test.net/.../default-zh
4. test.net/default-zh.aspx to test.net/.../default-zh
I am trying to rewrite/redirect these using urlrewriter.net.
But I don't know the regular expressions to achieve this. Please help.
Thanks,
Surya.
A good reference is here.
learn.iis.net/.../
Obviously, it helps if you already understand regular expressions, but the 'Match URL' section on IIS7.5 has a pattern-match test function, so you can trial and error your patterns against real URL examples, and get the R:n references for URL manipulation.
By default, the rewrite match expects to only test path and query, not the scheme and host.
So I believe you are using the URL rewriter from http://urlrewriter.net/. To remove the .aspx, I had to add the following section to my web.config. It basically takes whatever the URL is and strips the .aspx off of it.
<
rewriter
>
<
redirect
url
=
"~/(.+)\.aspx"
to
=
"~/$1"
/>
</
rewriter
>