Question

Hopefully a simple question although one I have found impossible to answer myself using the Googles!

I have a website on IIS with the URL http://www.contoso.com/ which points to C:\www\public\

There has been a forced directory restructure so now all of the data (Default.aspx, Product.aspx, etc.) that originally resided in C:\www\public\ now resides in C:\www\public\en\ie\ - however, the IIS website document root is still C:\www\public\

So, essentially, I have a lot of inbound links to http://www.contoso.com/Product.aspx?id=1 (etc.) which are now returning 404 errors - the correct link is now http://www.contoso.com/en/ie/Product.aspx?id=1

Please consider that I can make no changes to the directory structure or the IIS document root... so I must solve this issue using URL rewriting.

Is it possible to capture all requests to contoso.com/* and rewrite them to contoso.com/en/ie/* ??

Was it helpful?

Solution

As Ivo suggests, using url rewriting you can set up inbound rules that match the old url pattern and redirect to the new pattern

http://learn.iis.net/page.aspx/460/using-url-rewrite-module/

OTHER TIPS

Change the root directory of your website from C:\www\public\ to C:\www\public\en\ie\ and everything should be fine.

If you cannot do this for any reason, make a custom 404 page and rewrite to url in there and redirect with a 301

See: http://searchengineland.com/url-rewriting-custom-error-pages-in-aspnet-20-12234

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top