• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 89
  • Last Modified:

IIS Redirect

What is the best way to redirect ex.domain.com/ex  to just ex.domain.com?
0
PDIS
Asked:
PDIS
  • 2
1 Solution
 
Dan McFaddenSystems EngineerCommented:
Installing and using URL Rewrite.

Reference link:  http://www.iis.net/downloads/microsoft/url-rewrite

Dan
0
 
PDISAuthor Commented:
That tells me what URL Rewrite is but does not explain how to write one for what I need.
0
 
Dan McFaddenSystems EngineerCommented:
Insert the following structure into your web.config under the <configuration/system.webServer> section:

If the <system.webServer> section exists, add this under/in the <system.webServer> section:
        <rewrite>
            <rules>
                <rule name="Redirect /ex to /" stopProcessing="true">
                    <match url="^(ex).*" />
                    <action type="Redirect" url="/index.html" />
                </rule>
            </rules>
        </rewrite>

Open in new window


If the <system.webServer> section does not exist, add this under the <configuration> section :
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="Redirect /ex to /" stopProcessing="true">
                    <match url="^(ex).*" />
                    <action type="Redirect" url="/" />
                </rule>
            </rules>
        </rewrite>
    </system.webServer>

Open in new window


You can also create and add the redirect rule in the IIS Manager.
1. open IIS Manager
2. go to the website where you want to add the redirect
3. double click on the URL Rewrite feature
4. Click "Add Rule(s)" under the Actions section on the right hand site of the IIS Manager
5. The rule should be created as in the image below:

IIS8-redirect-ex-folder-to-root--web-pag
Dan
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now