Solved

IIS7 how to redirect to another site and keep same URL

Posted on 2012-03-27
8
1,500 Views
Last Modified: 2012-05-29
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
Comment
Question by:mike99c
  • 4
  • 3
8 Comments
 
LVL 11

Accepted Solution

by:
rajvja earned 167 total points
ID: 37771116
0
 
LVL 19

Assisted Solution

by:Albert Van Halen
Albert Van Halen earned 333 total points
ID: 37772958
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
 

Author Comment

by:mike99c
ID: 37773029
I have looked at the rewrite rule but I need the URL to to be unchanged in the browser window.
0
 
LVL 19

Assisted Solution

by:Albert Van Halen
Albert Van Halen earned 333 total points
ID: 37773055
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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 

Author Comment

by:mike99c
ID: 37773082
Can you please provide me with your rewrite rule as I am not clear how you can make it maintain the original URL.
0
 
LVL 19

Expert Comment

by:Albert Van Halen
ID: 37773874
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
 

Author Comment

by:mike99c
ID: 37808364
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
 

Author Comment

by:mike99c
ID: 37808658
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

Comprehensive Backup Solutions for Microsoft

Acronis protects the complete Microsoft technology stack: Windows Server, Windows PC, laptop and Surface data; Microsoft business applications; Microsoft Hyper-V; Azure VMs; Microsoft Windows Server 2016; Microsoft Exchange 2016 and SQL Server 2016.

Join & Write a Comment

Having worked on larger scale sites, we found out that you are bound to look at more scalable solutions to integrating widgets, code snippets or complete applications and mesh them into functional sites, in any given composition. To share some of…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now