301 Redirects for Already-Written URLs

janessaallen used Ask the Experts™
Hi, I have IIS 8 and url rewrite rules in place to make the urls friendly by converting the .aspx pages and parameters to a new, rewritten URL.  however, some of my maps have values that have changed, forcing me to have to do 301 redirects from one friendly URL to another.  Here is an example:

From: www.domain.com/friendly-url  needs to be redirected
To: www.domain.com/friendly-url-2

How do you get from one rewritten URL to another?
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
DevOps Manager
Top Expert 2011
Capture the {REQUEST_URI}  as /friendly-url and place a rule to forward to your other location.

 <rule name="URI to URI" stopProcessing="true">
                    <match url="(.*)" />
                        <add input="{REQUEST_URI}" pattern="^/friendly-url$" />
                    <action type="Redirect" url="http://{HTTP_HOST}/friendly-url2/" />


Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial