0

I'm looking to use the URLRewriting.config within Umbraco to set up some redirects. The majority of them are working fine, but a few are causing headaches.

I have a page: /testpage.aspx which on the new site is now under /directory/testpage.aspx. I've tried a couple of rules, but they either fall into a loop, or just send me to the first page - which obviously gives a 404 error.

As far as I can tell, the rule below should satisfy this rewrite and work, but instead I'm just getting the original page - which is a 404 on this site.

<add name="Redirect400" rewriteUrlParameter="ExcludeFromClientQueryString" redirect="Domain" ignoreCase="true" 
   virtualUrl="^~/testpage.aspx$" 
   destinationUrl="/directory/testpage.aspx" 
   redirectMode="Permanent" />

Those regular expressions (please correct me if I'm wrong), should be saying that any page that starts and ends with /testpage.aspx is redirected to the new URL? Can anyone offer any assistance on this?

edparry
  • 688
  • 1
  • 10
  • 34

1 Answers1

3

there is bit change in your virtual URL because that only gets which has www.domain.com/testpage.aspx

It will not get following results:

  1. www.domain.com/abc/testpage.aspx
  2. www.domain.com/abc/main/testpage.aspx
  3. www.domain.com/abc/main/test/testpage.aspx

Please try following, I haven't tested it but I am guessing it is that.

<add name="Redirect400" rewriteUrlParameter="ExcludeFromClientQueryString" redirect="Domain" ignoreCase="true" 
   virtualUrl="^~(.*)/testpage.aspx$" 
   destinationUrl="/directory/testpage.aspx" 
   redirectMode="Permanent" />

let me know if you need more help thanks

Ankur Ghelani
  • 659
  • 4
  • 16
  • Hi @ankur-ghelani, that's still not working for me. When I use that syntax, the URL still ends up as: `/directory/directory/directory/directory/directory/testpage.aspx` – edparry Oct 10 '12 at 13:34
  • I'm not 100% on whether this is the correct solution to the problem, but by using redirect="Application", the redirects are now working as they should, without falling into infinite loops. – edparry Oct 10 '12 at 15:12
  • 1
    some times, it is to do with IIS, it might needed restart and then it will get working, it could be that, it is good that you have found your solution of problem – Ankur Ghelani Oct 11 '12 at 09:07