使用微软的一款IIS7官方的重写组件
1、下载地址(
这里要注意操作系统是多少位的,我的系统是64位的,就下载x64的
):https://www.iis.net/downloads/microsoft/url-rewrite#additionalDownloads
2、安装重写模块
我下载的是本地msi包(rewrite_2.0_rtw_x64.msi),双击安装即可(如果IIS服务没停的话,安装完成后会要求重启系统。)
3、这个时候再进 “Internet 信息服务(IIS)管理器”,就可以看见模块中多了一个 Url Rewrite 模块
4、进入需要设置的站点,双击 Url Rewrite 图标,进入设置界面。
然后点击右侧的“Import Rules...”(导入重写规则)
5、将.htaccess扩展名文件导入并做修改,或则一条条添加规则
<Files ~ "^.(htaccess|htpasswd)$">
deny from all
</Files>
<FilesMatch ".(gif|jpg|jpeg|png|ico)$">
Header set Cache-Control "max-age=3600"
</FilesMatch>
ErrorDocument 400 http://www.freedede.cn/404.html ErrorDocument 401 http://www.freedede.cn/404.html ErrorDocument 402 http://www.freedede.cn/404.html ErrorDocument 403 http://www.freedede.cn/404.html ErrorDocument 404 http://www.freedede.cn/404.html ErrorDocument 405 http://www.freedede.cn/404.html ErrorDocument 406 http://www.freedede.cn/404.html ErrorDocument 407 http://www.freedede.cn/404.html ErrorDocument 408 http://www.freedede.cn/404.html ErrorDocument 409 http://www.freedede.cn/404.html ErrorDocument 410 http://www.freedede.cn/404.html ErrorDocument 411 http://www.freedede.cn/404.html ErrorDocument 412 http://www.freedede.cn/404.html ErrorDocument 413 http://www.freedede.cn/404.html ErrorDocument 414 http://www.freedede.cn/404.html ErrorDocument 500 http://www.freedede.cn/404.html ErrorDocument 501 http://www.freedede.cn/404.html ErrorDocument 502 http://www.freedede.cn/404.html ErrorDocument 503 http://www.freedede.cn/404.html ErrorDocument 504 http://www.freedede.cn/404.html ErrorDocument 505 http://www.freedede.cn/404.html order deny,allow RewriteEngine on RewriteCond %{HTTP_REFERER} !^$ RewriteCond %{HTTP_REFERER} !^http://(www.)?http://www.aitecms.com/(/)?.*$ [NC] RewriteRule ^tommyhu-([0-9]+)-([0-9]+)\.html$ aitecms.php?id={R:1}&page={R:2}
6、最后一个很棒的网站,提供htaceess文件生成服务 http://www.bm8.com.cn/webtool/htaccess/从0基础开始学习织梦dedecms建站,分享全套的织梦dedecms网站搭建教程、织梦安装使用教程。
汇聚了最全、最新的织梦cms建站教程。包含dedecms建站、仿站教程;dedecms系统使用常见问题;主题插件推荐下载等!欢迎学习! |
|