I am using Windows Server 2008 with IIS7. I need to redirect the users who come to www.mysite.com
to wwww.mysite.com/menu_1/MainScreen.aspx
. Here is the file structure I have for the projects:
-Sites -Default Web Site -Menu_1 -MenuService -VscWebService
I will really appreciate any help on this.
In IIS Manager, expand the server, expand Sites, and expand Default Web Site. Select the virtual directory, and verify Features View is selected at the bottom of the page. In the IIS section, double-click HTTP Redirect.
Simply put, a redirect is a client-side request to have the web browser go to another URL. This means that the URL that you see in the browser will update to the new URL. A rewrite is a server-side rewrite of the URL before it's fully processed by IIS.
Here it is. Add this code to your web.config file:
<system.webServer> <rewrite> <rules> <rule name="Root Hit Redirect" stopProcessing="true"> <match url="^$" /> <action type="Redirect" url="/menu_1/MainScreen.aspx" /> </rule> </rules> </rewrite> </system.webServer>
It will do 301 Permanent Redirect (URL will be changed in browser). If you want to have such "redirect" to be invisible (rewrite, internal redirect), then use this rule (the only difference is that "Redirect" has been replaced by "Rewrite"):
<system.webServer> <rewrite> <rules> <rule name="Root Hit Redirect" stopProcessing="true"> <match url="^$" /> <action type="Rewrite" url="/menu_1/MainScreen.aspx" /> </rule> </rules> </rewrite> </system.webServer>
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