删除HTML或ASPX扩展 [英] Remove HTML or ASPX Extension

查看:96
本文介绍了删除HTML或ASPX扩展的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在托管环境IIS7,我找了使用无扩展名的文件名,最简单的方法。只要我有以下页面:

In a hosted IIS7 environment, I am looking for the simplest way to use extension-less file names. Simply I have the following pages:

index.html的(或的.aspx) - > domain.com
gallery.html - > domain.com/gallery
videos.html - > domain.com/videos
等等...

index.html (or .aspx) --> domain.com gallery.html --> domain.com/gallery videos.html --> domain.com/videos etc...

我只有页面了一把,我没有动code,没什么特别的。我开发我发现所有的例子或我其他网站使用方法围绕动态内容,网页等,我只是在寻找最简单的解决方案,非常不需要安装任何类型的URL重写模块。 preferably,我可以保持.html扩展名,而不是该网站转换为ASP.NET项目,但是这是一个选项。

I only have a handful of pages, I have no dynamic code, nothing special. All the examples I have found or methods I use in other sites I've developed revolve around dynamic content, pages, etc. I am simply looking for the simplest solution, ideally not requiring any sort of url rewrite module installed. Preferably, I could keep the .html extension instead of converting the site to a ASP.NET project, but that is an option.

感谢。

推荐答案

我最终使用以下网站:

http://blogs.msdn.com/ b / carlosag /存档/ 2008/09/02 / iis7urlrewriteseo.aspx

http://forums.iis.net/t/1162450.aspx

或基本以下code使用的IIS7 URL重写模块,大多数托管的网站现在提供(在这种情况下,我使用GoDaddy)我的web.config文件:

or basically the following code in my web.config file using the IIS7 URL Rewrite Module that most hosted sites now offer (in this case I am using GoDaddy):

<rewrite>
    <rules>
        <rule name="RewriteASPX">
            <match url="(.*)" />
            <conditions logicalGrouping="MatchAll">
                <add input="{REQUEST_FILENAME}" matchType="IsFile" negate="true" />
                <add input="{REQUEST_FILENAME}" matchType="IsDirectory" negate="true" />
            </conditions>
            <action type="Rewrite" url="{R:1}.aspx" />
        </rule>
    </rules>
</rewrite>

这篇关于删除HTML或ASPX扩展的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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