I managed to convert my company old site from simple html pages to aspx using ubraco. The problem is that the site is indexed on google so if the user try to open the page it will not work because it's an old site that uses html pages. What I need to do is to rewrite all links from .html to .aspx, so I tried to use urlrewriter. Here is the example of the code in UrlRewriting.config:
I am guessing it does this because .NET is not set up to accept .html pages in your IIS. You will have to set your mappings in IIS to send .html pages to .NET. Are you getting generic 404 error or the umbraco 404 error because if you are getting the generic 404 error page and not the umbraco 404 error page then it is not going through .NET and thus would not go through your URL rewriting rules.
Catch all pages with previous file extension incase you miss one, or don't care to manually redirect each page (all non-existing .html to .aspx or extensionless urls):
Umbraco directoryUrls, by default if you enable, a page exists at somepage.aspx and somepage, this 301 redirects the .aspx page to the extensionless url without screwing up the umbraco backend
redirect html to aspx
Hi,
I managed to convert my company old site from simple html pages to aspx using ubraco. The problem is that the site is indexed on google so if the user try to open the page it will not work because it's an old site that uses html pages. What I need to do is to rewrite all links from .html to .aspx, so I tried to use urlrewriter. Here is the example of the code in UrlRewriting.config:
If I try to access .html page it trows me an 404 error. If anyone knows how to do this please help.
I am guessing it does this because .NET is not set up to accept .html pages in your IIS. You will have to set your mappings in IIS to send .html pages to .NET. Are you getting generic 404 error or the umbraco 404 error because if you are getting the generic 404 error page and not the umbraco 404 error page then it is not going through .NET and thus would not go through your URL rewriting rules.
I managed to get this work. As you said the IIS was not setup to use html files.
Here is the solution if anyone needs it.
First thing that need to be done is to add the html extension in IIS mappings. This is explained in this document UrlRewriting Doc on page 12.
Second thing is to add appropriate code in the UrlRewriting.config. Here is the example for some of them.
That's it. Hope it help someone.
Solid, thanks for this!
To add to this, here's 4 awesome rewriting rules that have been helpful to me:
Canonical Url (example.com to www.example.com)
Previous pages to their current counterpart (/about-us.html to /about-us.aspx or /about-us, depending on if you use directoryUrls)
Catch all pages with previous file extension incase you miss one, or don't care to manually redirect each page (all non-existing .html to .aspx or extensionless urls):
Umbraco directoryUrls, by default if you enable, a page exists at somepage.aspx and somepage, this 301 redirects the .aspx page to the extensionless url without screwing up the umbraco backend
Hope this helps someone!
Amir
is working on a reply...