Learn from 350 other Umbracians at the annual Umbraco Conference - CodeGarden '13.
More than twenty high quality sessions, open spaces, hackathons and social events you'll remember. Not to be missed! Less than 25 tickets left - get yours now!
It looks like a great package.
Most of the sites we do, are convertions of sites from other systems, which means url naming can be different from site to site.
On the one i'm trying to use your package on, the old files are alle named /default.aspx?id=48, with different numbers for each page.
So if i want to make "/default.aspx?id=48" go to the page i put the "umbraco301MovedPermanently" property onto.
Will this work?
And what about .php pages og static pages like .html and .htm?
If it does, this could be a Favorite SUPERPACKAGE :)
(Sorry for not getting back to you sooner - it's been a busy week here!)
I've done a quick test with the various URLs. A few things I found out...
So yes, any (non-Umbraco) .aspx pages and/or .php/.html/.whatever will work with this package.
The only caveat is that because I based the development of this package on the "SearchForAlias" code, it strips out the ".aspx" before searching the 301 redirected. So specifically for .aspx extensions ... remove the ".aspx" from the URL.
Hope that helps? Let me know if you have any other questions!
I can't seem to get non-Umbraco pages to redirect correctly. I would get a generic 404 error page. I'm running IIS 7.5 in integration mode, and when a static file is requested, it seems like IIS's StaticFile handler would serve up the 404 error page.
Is it a configuration setting I'm missing?
Hi Benny, you'll need to pipe everything through ASP.NET for this to work. There's a setting in the Web.config that should handle this for IIS7.
Hi Lee, thanks for the quick response. I tried that setting and it's still not working. Here's my <modules> and <handlers> sections from web.config:
<system.webServer> <validation validateIntegratedModeConfiguration="false" /> <modules runAllManagedModulesForAllRequests="true"> <!-- Asp.net 3.5 Modules--> <remove name="ScriptModule" /> <add name="ScriptModule" preCondition="managedHandler" type="System.Web.Handlers.ScriptModule, System.Web.Extensions, Version=184.108.40.206, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <!-- UMBRACO modules--> <add name="UrlRewriteModule" type="UrlRewritingNet.Web.UrlRewriteModule, UrlRewritingNet.UrlRewriter" /> <add name="umbracoRequestModule" type="umbraco.presentation.requestModule" /> <add name="viewstateMoverModule" type="umbraco.presentation.viewstateMoverModule" /> <add name="umbracoBaseRequestModule" type="umbraco.presentation.umbracobase.requestModule" /> </modules> <handlers> <!-- Asp.net 3.5 handlers--> <remove name="WebServiceHandlerFactory-Integrated" /> <remove name="ScriptHandlerFactory" /> <remove name="ScriptHandlerFactoryAppServices" /> <remove name="ScriptResource" /> <add name="SHTML" path="*.shtml" verb="*" modules="IsapiModule" scriptProcessor="C:\Windows\Microsoft.NET\Framework\v2.0.50727\aspnet_isapi.dll" resourceType="Unspecified" requireAccess="Script" preCondition="classicMode,runtimeVersionv2.0,bitness32" /> <add name="ScriptHandlerFactory" verb="*" path="*.asmx" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=220.127.116.11, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <add name="ScriptHandlerFactoryAppServices" verb="*" path="*_AppService.axd" preCondition="integratedMode" type="System.Web.Script.Services.ScriptHandlerFactory, System.Web.Extensions, Version=18.104.22.168, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <add name="ScriptResource" preCondition="integratedMode" verb="GET,HEAD" path="ScriptResource.axd" type="System.Web.Handlers.ScriptResourceHandler, System.Web.Extensions, Version=22.214.171.124, Culture=neutral, PublicKeyToken=31BF3856AD364E35" /> <!-- UMBRACO Handlers --> <add verb="*" name="Channels" path="umbraco/channels.aspx" type="umbraco.presentation.channels.api, umbraco" /> <add verb="*" name="Channels_Word" path="umbraco/channels/word.aspx" type="umbraco.presentation.channels.wordApi, umbraco" /> </handlers></system.webServer>
Hi Benny, not too sure what other settings there are in IIS7.5 to handle the static files (or at least pipe them through ASP.NET).
Unless anyone else knows how to fix this, I'd suggest googling around for "wildcard mappings in IIS7.5", see if you find anything useful?
Once you've got that working, the 301 package should will handle those requests too.
Thanks for the idea, I have already looked at wildcard mappings in IIS7. And apparently ASP.NET is handling the static files. It's just that for some reason, the 301 package doesn't get the static file requests.
I set up one page that should be the destination.aspx page for /test.aspx, /test.shtml, /test.html, /test.txt. Only the /test.aspx works. The other 3 all show an IIS 404 error page.
However, if I enable the "urlrewritingnet" component, then I can get test.shtml to redirect to destination.aspx.
Can anyone think of a reason why might be?
Not sure what the official name for it is in IIS7, but in IIS6 it was "Check if file exists". See these pages:
Thinking that you've got the "Invoke handler only if request is mapped to file" setting enabled. The second link should help you out? I hope!
I don't think that's it. Since I'm running in integrated pipeline mode, I didn't really create my own mapping for static files.
Just for fun, I did follow the steps in the 2nd link on the default Static File handler mapping that comes with IIS. After that, the non-existent static files just return an empty page instead of 404, but the "301 package" handler code still did not kick in.
Is it possible that Umbraco doesn't think that it should handle a static file request?
Actually, I just tried and it seems like test.asmx cannot be redirected either. This one returns an ASP.NET 404 page.
I too am facing the same issues. IIS 7.5, Umbraco 4.5.2, needing to process non aspx pages with a custom 404 redirect. How do we get this working?
Did anyone get any futher with this? All the best, Laurie