Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1887
  • Last Modified:

IIS7 how to redirect to another site and keep same URL

I am hosting a website on an IIS7 windows server and I have a URL like this:

www.mywebsite.com/blog

I would like to redirect this to another external website say:
www.anothersite.com

However I would still like www.mywebsite.com/blog to remain in the browser address bar so it appears the user is still on the same website.

Can someone please explain how this can be achieved via IIS?
0
mike99c
Asked:
mike99c
  • 4
  • 3
3 Solutions
 
Albert Van HalenCommented:
Have a look at the URL Rewrite Module.
See a nice tutorial here : http://learn.iis.net/page.aspx/461/creating-rewrite-rules-for-the-url-rewrite-module/
0
 
mike99cAuthor Commented:
I have looked at the rewrite rule but I need the URL to to be unchanged in the browser window.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
Albert Van HalenCommented:
I use it myself too.
I have url like http://mysite/article/1st_article which redirects to http://mysite/ViewArticle.aspx?ArticleText=1st%20article

It doesn't show the 'ugly' url in the browser...
0
 
mike99cAuthor Commented:
Can you please provide me with your rewrite rule as I am not clear how you can make it maintain the original URL.
0
 
Albert Van HalenCommented:
Here the exact rule I'm using.
  <rewrite>
  <rules>
    <rule name="Rewrite to article.aspx">
      <match url="^article/([\._0-9a-z-]+)" />
      <action type="Rewrite" url="ShowArticle.aspx?title={R:1}" />
    </rule>
  </rules>
</rewrite>

Open in new window

0
 
mike99cAuthor Commented:
Hi
Thanks for the response, have installed the URL rewrite module, but the problem is that I'm not great with regular expressions
I just want to substitue
www.mywebsite.com/blog
with
www.anothersite.com

Could you point me in the right direction?
Cheers
0
 
mike99cAuthor Commented:
I have tried the following:

            <rewrite>
              <rules>
                  <rule name="Rewrite to http://anothersite.com">
                    <match url="/blog" />
                    <action type="Rewrite" url="http://anothersite.com" />
                  </rule>
              </rules>
            </rewrite>

When I click on www.mywebsite.com/blog, nothing happens.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

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