IIS7.0通过web.config重定向失败怎么办
|
|
nisheng
发表于 2012-5-2 10:32:30
|
显示全部楼层
|
是godaddy空间的话可以参考http://bbs.idcspy.com/thread-165265-1-1.html这个 |
|
|
|
|
|
|
|
|
|
|
本帖最后由 wjia198 于 2012-5-2 12:33 AM 编辑
我用的是IIS7.0的空间,由于一开始的设计结构错误,那时候将所有文章直接放在了根目录下,随着文章数量的增多,现在每次打开FTP压力都非常大,很慢。
现在想把所有的文章都重定向到一个新目录下,那么原先的域名肯定要做跳转,不然,就会出现很多404错误了。
例如:
现在的文章页
http://www.domain.com/patent120428.html
跳转后的文章页
http://www.domain.com/wz/patent120428.html
也就是将所有文章都移到了根目录下的wz文件夹中,请告知如何实现。
要通过web.config来实现,不知道代码该怎么写。下面这样的代码我试过,不行,高手帮忙看下哪里有问题:- <?xml version="1.0" encoding="UTF-8"?>
- <configuration>
- <system.webServer>
- <rewrite>
- <rule name="Canonical Host Name" stopProcessing="true">
- <match url="(.*)" />
- <conditions>
- <add input="{HTTP_HOST}" pattern="^webweb\.com$" />
- </conditions>
- <action type="Redirect" url="http://www.webweb.com/wz/{R:1}" redirectType="Permanent" />
- </rule>
- </rewrite>
- </system.webServer>
- </configuration>
复制代码 还有,是不是可有参照这个代码改?怎么改呢?我是在根目录呢,那就没有bbs Redirect 。怎么办呢?- <?xml version="1.0" encoding="UTF-8"?>
- <configuration>
- <system.webServer>
- <urlCompression doStaticCompression="true" doDynamicCompression="true"/>
- <rewrite>
- <rules>
- <rule name="bbs Redirect" stopProcessing="true">
- <match url="bbs/.*" />
- <conditions>
- <add input="{HTTP_HOST}" pattern="^bbs.123.com$" />
- </conditions>
- <action type="Redirect" url="http://www.123.com/{R:0}" redirectType="Permanent" />
- </rule>
- </rules>
- </rewrite>
- </system.webServer>
- </configuration>
复制代码 |
|
|
|
|
|
|
|
|
|
|
wjia198
发表于 2012-5-2 00:32:02
|
显示全部楼层
|
谁来帮我解答啊!不管对不对我一定给你加分!非常感谢! |
|
|
|
|
|
|
|
|