However, when I visit the URL, it just takes me to a default 404 error page. How can I get this working - is the code above wrong or do I need to do something to tell the system to pick up the changes in the config file? I've modified web.config to try to 'refresh' things but no joy still.
Thanks Bob. I've tried a rule similar to yours and it does work - so it seems as if the config file is active, but whenever I change it to suit my situation it stops working. I'm also no authority on URL rewriting (clearly :)) but if anyone can shed any light on this I'd be most grateful - surely it's almost there?
Hmm, failing any direct solutions, is the way Umbraco handles URL rewriting the same as general .NET URL rewriting? Can I use general .NET documentation for this config setting or is that going to create problems?
probably the rule isn't firing because your IIS default document isn't set to a document that is handled by the .NET Framework (ie. default.htm). In IIS you can change this and have default.htm also be processed by ASP.NET.
Just to add... on the new site there's no such page as http://www.mydomain.com/old - it's just a virtual URL which needs to redirect to a new, physical URL.
In IIS go to your application properties, go to "home directory" tab, click configuration, on mappings tab click Add. Then for executable insert: C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll for Extension insert: .htm
If you request a directory name IIS will automatically try to find one of your default documents specified in your app settings (as described above).
Have you tried this?
If it doesn't work you might need to map the 404 in App properties > Custom Errors to a (non existing) 404.aspx page which will trigger the .net rewrite rule.
I've tried and it doesn't work unfortunately :(. Who'd have thought it would be so difficult to set up a single 301!?
So, if I go the 404 route, will that mean that it gets a lot complicated if other 301s have to be created in future? At the moment the client is only requiring 1 301 redirect, but eventually there could be 100+.
301 redirect not doing anything
Hi,
I've modifid the URLRewriting.config file in the /config folder, to the following (it's just a simple, single, one-off, hard-coded redirect required):
However, when I visit the URL, it just takes me to a default 404 error page. How can I get this working - is the code above wrong or do I need to do something to tell the system to pick up the changes in the config file? I've modified web.config to try to 'refresh' things but no joy still.
Any ideas? Thanks all.
my rules look a bit different...
<add name="KickIt3" virtualUrl="^http\://www.baty-barr.com/(.*).aspx"
rewriteUrlParameter="IncludeQueryStringForRewrite"
destinationUrl="http://baty-barr.com/$1"
redirect="Domain"
redirectMode="Permanent"
ignoreCase="true" />
i am NOT any kind of authority on url rewriting... but the rules i have made all appear to work.
Thanks Bob. I've tried a rule similar to yours and it does work - so it seems as if the config file is active, but whenever I change it to suit my situation it stops working. I'm also no authority on URL rewriting (clearly :)) but if anyone can shed any light on this I'd be most grateful - surely it's almost there?
Hmm, failing any direct solutions, is the way Umbraco handles URL rewriting the same as general .NET URL rewriting? Can I use general .NET documentation for this config setting or is that going to create problems?
Thanks
techincally, isn't the url going to be /old/something.ext ??? could that be your issue?
probably the rule isn't firing because your IIS default document isn't set to a document that is handled by the .NET Framework (ie. default.htm). In IIS you can change this and have default.htm also be processed by ASP.NET.
@Bob - The link which has been marketed is http://www.mydomain.com/old. ; On the old site (which was static HTML) this would have defaulted to http://www.mydomain.com/old/index.htm.
@Yannick - How do I get index.htm to be processed by ASP.NET?
Thanks both.
Just to add... on the new site there's no such page as http://www.mydomain.com/old - it's just a virtual URL which needs to redirect to a new, physical URL.
Apologies for the scattergun posting, but I've got a little further. I've changed my rule to:
And this now works when I enter http://www.mydomain.com/old/default.aspx, but still not when I enter http://www.mydomain.com/old - which is the marketed URL.
Does anyone know how to get over this final hurdle?
In IIS go to your application properties, go to "home directory" tab, click configuration, on mappings tab click Add. Then for executable insert:
C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll
for Extension insert: .htm
you might also want to do that for .html
just in case you have index.html at the top of your default pages (you can also check this in site properties > Documents tab.
Thanks Yannick - I'm confused though as there's no HTML page there, so why does this need to be added?
If you request a directory name IIS will automatically try to find one of your default documents specified in your app settings (as described above).
Have you tried this?
If it doesn't work you might need to map the 404 in App properties > Custom Errors to a (non existing) 404.aspx page which will trigger the .net rewrite rule.
I've tried and it doesn't work unfortunately :(. Who'd have thought it would be so difficult to set up a single 301!?
So, if I go the 404 route, will that mean that it gets a lot complicated if other 301s have to be created in future? At the moment the client is only requiring 1 301 redirect, but eventually there could be 100+.
No, the 404 trick is just to make sure your directory calls get handled by .NET. Only needs to be set once.
When I try to edit the 404 'file' in Custom Errors using a non-existent page, it won't let me save because the page doesn't exist.
Ah, apparently you have to create a 404.aspx first.
Thanks Yannick - I appreciate your patience.
Do I create the 404 as per any other page through Umbraco, or do I just upload a blank page called 404.aspx to the root of the domain via FTP?
I guess for IIS to see it you should upload an empty 404.aspx through FTP. hope it works for you!
is working on a reply...