IIRF在IIS6 - 几个域一个IP重新定向到不同模式索引页 [英] IIRF on iis6 - several domain to one ip redirect to defferent index pages

查看:168
本文介绍了IIRF在IIS6 - 几个域一个IP重新定向到不同模式索引页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我不能说好英语:) - 对不起〜

我有一台服务器托管。 (一个IP)

和此Web服务器有三个索引页。

// Default.asp的// s1_default.asp S2-的default.asp

我有三个领域。 aaa.com和放大器;两个免费的子域名。 (s1.free.com,s2.free.com前)

我已经安装IIRF的IIS6。

我想重写或重定向到aaa.com ------->的default.asp s1.free.com ---> s1_default.asp s1.free.com ---> s1_default.asp

谢谢!


解决方案

我觉得这个教程将帮助你,甚至给你一些亲和反一种替代解决方案。
http://www.seoconsultants.com/windows/isapi/subdomains/

从链接的教程引用:


  

设置DNS服务器


  
  

添加下面进入您的DNS服务器,并相应地更改域名和IP地址。


  
  

*。example.com IN A 1.2.3.4。


  
  

安装Web服务器


  
  

我们假定您已经有你的主站创建了一个网站:www.example.com。所以我们就仔细检查,以确保它能够接受子域的所有版本。


  
  

打开IIS管理控制台,选择您的网站。
  右键单击它并选择属性。
  单击Web站点选项卡。
  点击高级按钮。
  确保有多重身份下一个条目此Web站点与主机头名称字段为空。此项目将拦截谈到这个IP地址的所有请求。
  确保IP地址仅用于本网站。
  设置为的httpd.ini的ISAPI_Rewrite


  
  

添加以下code你的httpd.ini在Web根目录下。确保它们是正确的顺序。


 #转换http://example.com加入http://www.example.com/~~V
的RewriteCond主机:^ example.com
重写规则HTTP \\(。*):// WWW \\ .example.com的$ 1 [I,RP]#假设我们只有有限的共享文件夹的数量。
#我们将执行相应的他们无论子域。
#示例:http://sub1.example.com/img/logo.jpg - > /img/logo.jpg
#示例:http://www.example.com/img/logo.jpg - > /img/logo.jpg
重写规则(/css/.*)$ 1 [I,O,L]
重写规则(/js/.*)$ 1 [I,O,L]
重写规则(/img/.*)$ 1 [I,O,L]#REDIRECT其他所有子目录不匹配
q若要上面的列表作为子域
#示例:www.example.com \\ SUB1 - > sub1.example.com
的RewriteCond主持人:WWW \\ .EXAMPLE \\ .COM
重写规则/(\\w*)/(.*)HTTP \\:// $ 1 \\ .EXAMPLE \\ .COM $ 2 [我,RP]#如果Web站点以www开头,则该文件指向根文件夹
#如果你专门创建一个文件夹/ WWW /然后就可以注释掉这一部分。
的RewriteCond主机:(?:WWW \\)。example.com
重写规则(。*)$ 1 [I,O,L]#任何网站开始不是www将被重新映射到/&LT等;子> /
#示例:http://sub1.example.com/default.asp - > /sub1/default.asp
#注意:如果文件夹不存在,那么该用户将自动获得一个404错误。
主机的RewriteCond:\\ example.com(*)。
重写规则(。*)/ $ 1 $ 2 [I,O,L]在文件夹#Fix失踪斜线字符
#此有在年底,因为如果无效的目录存在,
#we应该显示404首
的RewriteCond主机:(*)。
重写规则([^?] + [^ /?])HTTP \\:// $ 1 $ 2 / [I,RP]


  

测试子域


  
  

假设我们的公司网站和两个子域创建:SUB1,SUB2


  
  

URI位置服务器


  http://www.example.com /
http://sub1.example.com/img/logo.jpg /img/logo.jpg
http://sub2.example.com / SUB2 /
http://abc.example.com / ABC / - >错误(404


  

解决方案2:摘要


  
  

第二个解决方案更容易实施,只需要该网站的一个实例,用户必须小心有关创建的文件夹。例如,用户不能创建文件夹D:\\的Inetpub \\ wwwroot的\\ example.com \\ SUB1 \\ IMG \\因为它将与的下ISAPI_Rewrite规则(/img/.*)冲突。因此,该文件夹中的文件将无法访问。


I can not speak English well :) - sorry~

I have one server hosting. (one ip)

and this web server has three index pages.

default.asp // s1_default.asp // s2-default.asp

I have three domains. aaa.com & two free sub domains. (s1.free.com, s2.free.com ex)

I've installed iirf for iis6.

I want rewrite or redirect to aaa.com -------> default.asp s1.free.com ---> s1_default.asp s1.free.com ---> s1_default.asp

Thanks!!!

解决方案

I think this tutorial will help you and even give you some pro and contra for an alternative solution. http://www.seoconsultants.com/windows/isapi/subdomains/

Quote from the linked tutorial:

Setup DNS Server

Add the following entry into your DNS server and change the domain and IP address accordingly.

*.example.com IN A 1.2.3.4

Setup the Web Server

We are assuming that you already have a web site created for your main site: www.example.com. So let's just double check to make sure it will be able to accept all variations of the subdomains.

Open IIS Management Console and select your web site. Right click on it and select Properties. Click on Web Site tab. Click on Advanced button. Make sure there is one entry under the Multiple identities for this Web Site with Host Header Name field blank. This entry will intercept all requests that comes to this IP address. Make sure the IP address is only used by this web site. Setup httpd.ini for ISAPI_Rewrite

Add the following code to your httpd.ini in the web root. Make sure they are in the correct order.

# Convert http://example.com to http://www.example.com/
RewriteCond Host: ^example.com
RewriteRule (.*) http\://www\.example.com$1 [I,RP]

# Assuming we have limited number of shared folders.
# We will execute them accordingly regardless of the subdomain.
# Example: http://sub1.example.com/img/logo.jpg -> /img/logo.jpg
# Example: http://www.example.com/img/logo.jpg -> /img/logo.jpg
RewriteRule (/css/.*) $1 [I,O,L]
RewriteRule (/js/.*) $1 [I,O,L]
RewriteRule (/img/.*) $1 [I,O,L]

#Redirect all other subdirectories not matching
#to the list above as subdomains
#example: www.example.com\sub1 -> sub1.example.com
RewriteCond Host: www\.example\.com
RewriteRule /(\w*)/(.*) http\://$1\.example\.com$2 [I,RP]

# If the web site starts with www then point the file to the root folder
# If you specifically created a folder /www/ then you can comment out this section.
RewriteCond Host: (?:www\.)example.com
RewriteRule (.*) $1 [I,O,L]

# Any web site starts other than www will be re-mapped to /<subdomain>/
# Example: http://sub1.example.com/default.asp -> /sub1/default.asp
# Note: if the folder does not exists, then the user will get a 404 error automatically.
RewriteCond Host: (.*)\.example.com
RewriteRule (.*) /$1$2 [I,O,L]

#Fix missing slash char on folders
#This has to be at the end because if invalid dir exists,
#we should show 404 first
RewriteCond Host: (.*)
RewriteRule ([^.?]+[^.?/]) http\://$1$2/ [I,RP]

Test the Subdomains

Assuming we have the company website and two subdomains created: sub1, sub2.

URI LOCATION ON SERVER

http://www.example.com  /
http://sub1.example.com/img/logo.jpg    /img/logo.jpg
http://sub2.example.com /sub2/
http://abc.example.com  /abc/ -> 404 Not Found

Solution 2: Summary

The second solution is easier to implement and only requires one instance of the website, the user has to be careful about creating the folders. For example, the user can not create a folder d:\inetpub\wwwroot\example.com\sub1\img\ because it would conflict with the ISAPI_Rewrite Rule of (/img/.*). Therefore the files in that folder will not be accessible.

这篇关于IIRF在IIS6 - 几个域一个IP重新定向到不同模式索引页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆