views:

334

answers:

1

Hello,

How i can set redirect url for virtual directory in iis 7.0.I have installed lates url rewrite module 2. ?

I could explain my problem with exsample.

I have website on my iis 7.0 server:

www.mysite.com

I desided to create virtual directory sales under my site which is pointing to website root directory.Now I need create redirect url for the vdir. The vdir is pointing same virtual root directory as my site root is

The big idea is that i can write on browser www.mysite/sales and i will automaticly redirect to url www.mysite.com?productid=200.

I tried to make redirect with rewite url for vdir(not website), but I always get this error message :

cannot add duplicate colletion entry of type 'rule' with unique key key attribute 'name' set to "test".This happens when i am pointing for virtual vdir and try to add rule.

I can add rules to website level,but rules doesn work. I mean url www.mysite/sales gives me follwing error. I know that key is unique I checked it from web.config.

This kind of feature was really easy use in IIS 6.0, just point vdir with your mouse and set properties-->a redirect to url.

Please some one explain what is right way to do it in IIS 7.0

+1  A: 

Actually not quite as easy, but not too horrible.

1) Create a physical directory instead of a virtual directory.

2) Make sure you have HTTP Redirect role services. See http://www.iis.net/ConfigReference/system.webServer/httpRedirect

3) Open IIS Manager and browse to the physical directory you want to redirect.

4) Double click on the 'HTTP Redirect' icon under IIS.

5) Check the "Redirect requests to this destination" box and enter the new URL (http://domain.com/newPage.html)

6) Check the next two boxes as needed; I find it usually necessary to check both.

7) Press Apply button.

8) Select Web site and 'Restart' under Manage Web Site.

9) Test.

James Skemp
Good answer, +1
ajdams