URL Redirect

Hi All

I'm using a Windows Server 2012 R2 Standard with IIS Version 8.5.9600. I'm trying to redirect link A to link B, see below

Link A
ifly.com.au/special

Open in new window


Link B
https://downunder.iflyworld.com/book-now/gifting-step3-special?code=BLOCKS&tunnel=PEN

Open in new window


I created a web.config file under the iFLY.com.au folder, the web.config consists of the below

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
<httpRedirect destination="https://downunder.iflyworld.com/book-now/gifting-step3-special?code=BLOCKS&tunnel=PEN"/>
    </system.webServer>
</configuration>

Open in new window


When I try to access the iFLY.com.au/special I get the
500 - Internal server error.

500 - Internal server error.
There is a problem with the resource you are looking for, and it cannot be displayed.

Open in new window


Any help is greatly appreciated!
Stevie ZakhourAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

mccarlIT Business Systems Analyst / Software DeveloperCommented:
the <httpRedirect> element has an attribule "enabled" that is false by default, so for anything to work you would have to include...

enabled="true"

Also, though I'm not sure how this redirect is targeting the    /special    link as you said that you are putting this web.config in the websites root directory? Should you have a <location> element surrounding the <httpRedirect> so that it targets just the  /special link?
Stevie ZakhourAuthor Commented:
Thanks Mccarl.

I have resolved this, below is what I used in the web.config file

<?xml version="1.0" encoding="UTF-8"?>
<configuration>
    <system.webServer>
        <rewrite>
            <rules>
                <rule name="RedirectUserFriendlyURL1" stopProcessing="true">
                    <match url="^book-now/gifting-step3-special$" />
                    <conditions>
                        <add input="{REQUEST_METHOD}" pattern="^POST$" negate="true" />
                        <add input="{QUERY_STRING}" pattern="^code=([^=&amp;]+)&amp;tunnel=([^=&amp;]+)$" />
                    </conditions>
                    <action type="Redirect" url="{C:1}/{C:2}" appendQueryString="false" />
                </rule>
                <rule name="RewriteUserFriendlyURL1" stopProcessing="true">
                    <match url="^([^/]+)/([^/]+)/?$" />
                    <conditions>
                        <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                        <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
                    </conditions>
                    <action type="Rewrite" url="book-now/gifting-step3-special?code={R:1}&amp;tunnel={R:2}" />
                </rule>
            </rules>
            <outboundRules>
                <rule name="OutboundRewriteUserFriendlyURL1" preCondition="ResponseIsHtml1">
                    <match filterByTags="A, Form, Img" pattern="^(.*/)book-now/gifting-step3-special\?code=([^=&amp;]+)&amp;(?:amp;)?tunnel=([^=&amp;]+)$" />
                    <action type="Rewrite" value="{R:1}{R:2}/{R:3}/" />
                </rule>
            </outboundRules>
        </rewrite>
        <httpRedirect destination="https://downunder.iflyworld.com/book-now/gifting-step3-special?code=BLOCKS&amp;tunnel=PEN" />
    </system.webServer>
</configuration>

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
iis8

From novice to tech pro — start learning today.