Microsoft URL重写模块和图像 [英] Microsoft URL Rewrite Module and Images

查看:82
本文介绍了Microsoft URL重写模块和图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用Microsoft URL重写模块并且有问题

1-如果可能,我需要重写以忽略图像和CSS以及所有其他文件和目录.
我尝试了以下规则,但没有成功

I''m using Microsoft URL Rewrite Module and have a problem

1- I need for rewriting to ignore images and css and all other files and directories if possible.
I''ve tried the following rule but it didn''t work

<rule name="Remove trailing slash" stopprocessing="true">
        <match url="(.*)/$" />
        <conditions>
            <add input="{REQUEST_FILENAME}" matchtype="IsFile" negate="true" />
            <add input="{REQUEST_FILENAME}" matchtype="IsDirectory" negate="true" />
        </conditions>
        <action type="Redirect" redirecttype="Permanent" url="{R:1}" />
</rule>




2-我添加了以下规则,因为我的图像和css文件位于名称为样式"的目录中




2- I''ve added the following rule as my images and css files are in a directory with name "Style"

<rule name="RewriteImages" stopprocessing="true">
        <match url="^Style/(.+)" />
        <action type="Rewrite" url="Style/{R:1}" />
</rule>



适用于0和1级:



It works fine for 0 and 1 level:

domain-name.com
domain-name.com/phrase1



但是,使用多个级别时,不会显示图像:



But image is not displayed while using more than one level:

domain-name.com/phrase1
domain-name.com/phrase1/phrase2
domain-name.com/phrase1/phrase2/phrase3
etc.
!!!!



但是css文件中的样式仍然可以使用

另一个问题..
重写在localhost上不起作用,我正在使用Visual Web Developer Express2008.


请紧急提供帮助.



But still the styles in css file is working

Another Question..
Rewriting doesn''t work on localhost, I''m using Visual Web Developer Express 2008.


Please help urgently.

推荐答案

" / > < 条件 > < 添加 =" {REQUEST_FILENAME}" 匹配类型 IsFile " 否定 true" / < 添加 =" {REQUEST_FILENAME}" 匹配类型 IsDirectory " 否定 true" / < /conditions > < 动作 =" 重定向" 重定向类型 永久" url =" {R:1}" / > < /rule >
" /> <conditions> <add input="{REQUEST_FILENAME}" matchtype="IsFile" negate="true" /> <add input="{REQUEST_FILENAME}" matchtype="IsDirectory" negate="true" /> </conditions> <action type="Redirect" redirecttype="Permanent" url="{R:1}" /> </rule>




2-我添加了以下规则,因为我的图像和css文件位于名称为样式"的目录中




2- I''ve added the following rule as my images and css files are in a directory with name "Style"

<rule name="RewriteImages" stopprocessing="true">
        <match url="^Style/(.+)" />
        <action type="Rewrite" url="Style/{R:1}" />
</rule>



适用于0和1级:



It works fine for 0 and 1 level:

domain-name.com
domain-name.com/phrase1



但是,使用多个级别时,不会显示图像:



But image is not displayed while using more than one level:

domain-name.com/phrase1
domain-name.com/phrase1/phrase2
domain-name.com/phrase1/phrase2/phrase3
etc.
!!!!



但是css文件中的样式仍然可以使用

另一个问题..
重写在localhost上不起作用,我正在使用Visual Web Developer Express2008.


请紧急帮助.



But still the styles in css file is working

Another Question..
Rewriting doesn''t work on localhost, I''m using Visual Web Developer Express 2008.


Please help urgently.


这篇关于Microsoft URL重写模块和图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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