We are migrating some sites over to Azure and I have it setup as a "Web Site".
An example of what we're trying to do is pretty straight forward.
Current URL: http://www.website.com/Products.aspx Clean URL: http://www.website.com/Products/
So in the web.config, there is the following:
<system.webServer>
<rewrite>
<rules>
<rule name="ProductList">
<match url="/Products.aspx" />
<action type="Redirect" url="/Products" />
</rule>
</rules>
</rewrite>
</system.webServer>
This was generated in IIS. I have tried to set the stopProcess attribute to true... which is a solution that I've seen in a few threads, but nothing is working.
This website is one of our legacy sites that uses an ISAPI module for Rewrites. Since we aren't using an Azure VM, we cannot continue using this method to rewrite.
Is there something I'm missing here?
Url Rewrite module is enabled by default on Azure websites and you can create your rewrite or redirect rules using a web.config. Open the Web.config file located at the site root (D:\home\site\wwwroot). If you do not have a Web.config file in the directory, create it.
Url Rewrite module is enabled by default on Azure websites and you can create your rewrite or redirect rules using a web.config. Open the Web.config file located at the site root (D:\home\site\wwwroot). If you do not have a Web.config file in the directory, create it. Copy and paste the following XML section into the system.webServer element:
The solution is to use an URL rewrite solution, which will redirect the simple URL to the composed URL. We can achieve this using an Azure Web app. The following are the steps which will be conducted during this walk-through: Create an Azure Web app. Configure the Azure Web app. Create the URL Rewrite Configuration file.
Azure Websites use the IIS web server and hence does not work with mod_rewrite which is an Apache module. Url Rewrite module is enabled by default on Azure websites and you can create your rewrite or redirect rules using a web.config. Open the Web.config file located at the site root (D:\home\site\wwwroot).
Azure Web Sites does not have the URL Rewrite module installed, so the config approach won't work. Maybe you could update the site code to use ASP.NET URL routing, as described in this blog post by Scott Gu: http://weblogs.asp.net/scottgu/archive/2009/10/13/url-routing-with-asp-net-4-web-forms-vs-2010-and-net-4-0-series.aspx
Azure Web Sites didn't used to have the URL Rewrite Module installed, but now it does, so you can just use the standard <system.webServer><rewrite>
section in your web.config
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With