Thanks for your prompt input but is this not going to effect the entire website? I am just looking for redirection on a virtual directory http://www.website.com/vir
Thanks again,
Nabs
Main Topics
Browse All TopicsHello,
How can I configure IIS 5 to redirect a website (virtual directory) to a secured site? When users type http://www.website.com/web
Thanks in advance
Nabs
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
Thanks for your prompt input but is this not going to effect the entire website? I am just looking for redirection on a virtual directory http://www.website.com/vir
Thanks again,
Nabs
Other things might be set your virtual home directory properties, instead to specific folder, make it to specific url:
https://www.website.com/vi
Simpler solution:
1. Create one html page, name it redirectssl.htm and save it into your virtual directory folder. Here is the redirectssl.htm content:
<script language=javascript>
self.location = "https://www.website.com/v
</script>
<noscript>
<META HTTP-EQUIV=Refresh CONTENT="1; URL=https://www.website.co
</noscript>
2. Open your IIS, right click on your virtual directory site, click Properties.
3. Switch to Custom Error Tab
4. Edit properties of 403;4.
5. Set message type to FILE
6. Click browse button and point it into your redirectssl.htm
7. Click OK button twice.
Now try to put http://www.website.com/vir
HTH.
You need something similar to Apache's Rewrite....
http://www.isapirewrite.co
This tool will let your server redirect URLs based on various criteria.
ShalomC
so now to apply this to our current directory, should I just insert this code in it or how do I go about this?
--> just need to insert that code (in fact, thanks to your post, i'm using it myself for my server now)
I don't see the contents of the page. It redirects it to https but its just a page with an error!
--> what error now?
Each website has a default document, the redirect should be named that (I.E. default.htm)
The target website has a document you want people to load, so specify it in the code.
---
script language=javascript>
self.location = "https://www.website.com/v
</script>
---
We use an SSL accerlerator so ASP doesn't see the request as HTTPS. I came up with the code below to perform the redirect using JavaScript since the client always sees the request as SSL.
<SCRIPT LANGUAGE="JavaScript">
if (location.protocol != 'https:'){
window.location= 'https://' + location.host + location.pathname + location.search
}
</SCRIPT>
Just wanted to post my solution.
Basicaly same as above by Daniel
1. Open your IIS, right click on your virtual directory site, click Properties.
2. Switch to Custom Error Tab
3. Edit properties of 403;4.
4. Set message type to FILE
5. Click browse button and point it into your redirect.htm
6. Click OK button twice.
redirect.html
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>API E-MAIL SERVER</title>
<meta http-equiv="REFRESH" content="1;url=https://sit
<BODY>
Loading... https://site/exchange
</BODY>
</HTML>
note:
content="1 - is the time in seconds it will take to redirect
Another (and perhaps better) way is to have two websites - one that accepts host headers for mysite.com, .org, .net and whatever else you want. Everything is on port 80. In the Home Directory tab in IIS manager, set it to "A redirection to a URL". Enter https://mysite.com. Also check the permanent redirect box.
Next, in the site you want to force SSL, make sure it also responds to the mysite.com host header, but change the port to something high - make sure its unreachable behind your firewall. Set the security as necessary and you're done.
I have to agree with dmbrubac (for IIS, anyway). Changing the 403;4 error page to a redirect will send you to the the same page every time. If you have hyperlinks from other websites that point to subdirectories within the domain, the hyperlinks will not go where expected, instead they will always point to the URL in the redirect--forcing the unsuspecting user to re-navigate to the desired page once they arrive.
With two websites (on IIS), you can set the redirect from the port 80 site to https://mysite.com$S$Q, which will act as expected and send the user to the desired subdirectory every time.
Business Accounts
Answer for Membership
by: daniel_cPosted on 2003-10-05 at 19:24:21ID: 9495907
Add small snippet in your default.asp
HTTPS") = "on") ERVER_NAME ") & Request.ServerVariables("U RL") UERY_STRIN G") <> "" then UERY_STRIN G")
<%
bSSLOn = (Request.ServerVariables("
if not bSSLOn then
sURL = "https://" & Request.ServerVariables("S
if Request.ServerVariables("Q
sURL = sURL & "?" & Request.ServerVariables("Q
end if
Response.Redirect sURL
end if
%>
HTH.