Search code examples
c#url-rewritingumbracoumbraco7umbraco6

.aspx URLS giving 404 - Umbraco 6.2.1


I have just started working on an existing umbraco project built by another developer. The project is using version 6.2.1.

In the root of the website I have a aspx file but when I try to browse the page:

Example: wwww.mywebsite.com/myfile.aspx I get a 404

I have a txt file in the same location and this works:

Example: www.mywebsite.com/myfile.txt   < WORKS I CAN SEE THE PAGE.

I have had a look at the UrlRewriting.config file and I found this.

<add name="301RedirectDirUrls"
    redirectMode="Permanent"
    redirect="Application"
    ignoreCase="true"
    rewriteUrlParameter="IncludeQueryStringForRewrite"
    virtualUrl="^\/(?!(umbraco\/|data\/|install\/|usercontrols\/|umbraco_client\/))(.*)\.aspx"
    destinationUrl="$1/$2" />

Is this rule stooping my aspx URLs not to work?

How can I have a separate aspx file inside my umbraco site that responds to:

wwww.mysite.com/myfile.aspx

UPDATE: I have found that this URL rule is the reason why .aspx URLs are not being processed.

BUT... I have now realized I need the URL re-writing rule, but I want to exclude ONE URL

So if some one requests

www.mywebsite.com/myfile.aspx I want it to be processed all other *.aspx urls I don't. Can someone point me in the direction of how to modify this URL rule to achieve this:

<add name="301RedirectDirUrls"
    redirectMode="Permanent"
    redirect="Application"
    ignoreCase="true"
    rewriteUrlParameter="IncludeQueryStringForRewrite"
    virtualUrl="^\/(?!(umbraco\/|data\/|install\/|usercontrols\/|umbraco_client\/))(.*)\.aspx"
    destinationUrl="$1/$2"

     />

Solution

  • In the root web.config there are umbracoReservedUrls & umbracoReservedPaths keys which can be used to set up pages and folders that are not going to get processed by umbraco (which hijacks the asp.net request pipeline for aspx calls). So stuff like the install files & the back office urls is usually in there, but you can add your own:

    <add key="umbracoReservedUrls" value="~/config/splashes/booting.aspx,~/install/default.aspx,~/config/splashes/noNodes.aspx,~/rest" />
    <add key="umbracoReservedPaths" value="~/umbraco,~/install/,~/rest/" />