UrlRewriting is redirecting to default.aspx insted of /
I have setup som rules for UrlRewriting in urlrewriting.config, my problem is that it redirect to default.aspx insted of just /. When the rule is not used the client see the url www.example.com/, when the rule is used it redirect to www.exaple.com/default.aspx.
How can i setup the rule to redirect to the root without default.aspx?
In the urlrewriting.config in the urlrewritingnet section tag have you got a defaultPage set? I was having the same problem as you and then I removed the defaultPage from the tag - this worked on my VPS which is running IIS6, it didnt work on my local machine which runs IIS7.
Morten: your surgestion is almost working, it works fine if i redirect from the a domain with our www to the same domain with www. But if i try to redirect from another domain, it isn't working. But the this is working (i removed the "$1" in destinationUrl):
Hmm, I am not sure what you are trying to do. You want to redirect from one domain to another, preserving the url? Could you give an example of the url that the user visits, and the url you want him to be ridirected to?
If I do like underneath, and type "myfirstdomain.com" in the browser, I get "www.myseconddomain.com/Default.aspx". If i remove $1 from the destinationUrl it redirect to "www.myseconddomain.com".
The first two would try to match urls that should go to the root of the second domain, and the third one would catch any other content urls the browser would request.
It correctly works for every page but home page where it appends /Default.aspx. So, going to example.com/somepage.aspx correctly redirects to www.example.com/somepage.aspx
... but... going to example.com redirects to www.example.com/Default.aspx and I really do not want Default.aspx at the end. I did not try to write 2 rules for it, suggested in previous post as it seems to me like multiple 301 redirects in case where I redirect another domain to this one (which i do) so I would get: example2.com -> www.example.com/Default.aspx -> www.example.com
There must be a better way.
DefaultPage parameter is not in my urlrewrite.config but if I put it there myself it changes nothing.
What i've gathered from a few hours of knocking my head against the wall finding a solution - is that the windows server (the ISS) somehow supports a "default" file, which could seem to be the root of all evil with this default.aspx?
For SEO reasons i cannot have /default.aspx or /frontpage.aspx - i just want it as a clean www.mysite.com/
I do not have access to the ISS on my server, but can anyone verify this, or is it all complete jibberish?
Did anyone resolve this in the end because I have the same problem. I can try Mortons fix because I am running Umbraco 4.5.1 but does it mean that if I upgrade to a later version then the problem is going to return?
UrlRewriting is redirecting to default.aspx insted of /
I have setup som rules for UrlRewriting in urlrewriting.config, my problem is that it redirect to default.aspx insted of just /. When the rule is not used the client see the url www.example.com/, when the rule is used it redirect to www.exaple.com/default.aspx.
How can i setup the rule to redirect to the root without default.aspx?
my rule is as follows:
<add name="example" virtualUrl="http\://example.dk" rewriteUrlParameter="ExcludeFromClientQueryString" destinationUrl="http://www.example.dk" redirect="Domain" redirectMode="Permanent" ignoreCase="true" />
thanks in advance
I have a domain rewrite like this:
This takes any request to htttp://example.com type urls, and redirects to the same page just with a www. in fornt.
Does that answer your question?
In the urlrewriting.config in the urlrewritingnet section tag have you got a defaultPage set? I was having the same problem as you and then I removed the defaultPage from the tag - this worked on my VPS which is running IIS6, it didnt work on my local machine which runs IIS7.
Thanks a lot for your reply's!
Morten: your surgestion is almost working, it works fine if i redirect from the a domain with our www to the same domain with www. But if i try to redirect from another domain, it isn't working. But the this is working (i removed the "$1" in destinationUrl):
Strange or what?
Hmm, I am not sure what you are trying to do. You want to redirect from one domain to another, preserving the url? Could you give an example of the url that the user visits, and the url you want him to be ridirected to?
Hi Morten and thanks for your reply!
If I do like underneath, and type "myfirstdomain.com" in the browser, I get "www.myseconddomain.com/Default.aspx". If i remove $1 from the destinationUrl it redirect to "www.myseconddomain.com".
Hmm, sounds a bit strange, but maybe this could be a workaround.
Since the urlRewriting works with "first match" principle, you could make three rules.
The first two would try to match urls that should go to the root of the second domain, and the third one would catch any other content urls the browser would request.
I'm bumping this up as I have same problem:
It correctly works for every page but home page where it appends /Default.aspx. So, going to example.com/somepage.aspx correctly redirects to www.example.com/somepage.aspx
... but... going to example.com redirects to www.example.com/Default.aspx and I really do not want Default.aspx at the end. I did not try to write 2 rules for it, suggested in previous post as it seems to me like multiple 301 redirects in case where I redirect another domain to this one (which i do) so I would get: example2.com -> www.example.com/Default.aspx -> www.example.com
There must be a better way.
DefaultPage parameter is not in my urlrewrite.config but if I put it there myself it changes nothing.
Hi I have same problem, it redirects to default.aspx instead of /
Only working solution is Morten's workaround,
Is there anyone, who solved it in better way?
As i've discovered so far, Mortens workaround doesn't seem to work in Umbraco v 4.5.2
I've tried to add the rules to the UrlRewriting.config - but it still only rewrites from non-www to www.
Sadly, when it redirects from http://mysite.com to http://www.mysite.com it also adds /default.aspx - as some of the others here.
What i've gathered from a few hours of knocking my head against the wall finding a solution - is that the windows server (the ISS) somehow supports a "default" file, which could seem to be the root of all evil with this default.aspx?
For SEO reasons i cannot have /default.aspx or /frontpage.aspx - i just want it as a clean www.mysite.com/
I do not have access to the ISS on my server, but can anyone verify this, or is it all complete jibberish?
- Thomas Egebrand Gram
Did anyone resolve this in the end because I have the same problem. I can try Mortons fix because I am running Umbraco 4.5.1 but does it mean that if I upgrade to a later version then the problem is going to return?
Sorry, please ignore my post, my issue was resolved by removing:
defaultPage
= "default.aspx"
is working on a reply...