源码论坛公告:本站是一个交流学习建站资源的社区论坛,旨在交流学习源码脚本等资源技术,欢迎大家投稿发言! 【点击此处将锦尚放在桌面

源码论坛,商业源码下载,尽在锦尚中国商业源码论坛

 找回密码
 会员注册

QQ登录

只需一步,快速开始

查看: 11358|回复: 0
打印 上一主题 下一主题

[其他方面] .htAccess和httpd.ini和Nginx之间的伪静态规则互相转换方法

[复制链接]

12

主题

523

帖子

10

金币

初级会员

Rank: 1

积分
553
QQ
跳转到指定楼层
1#
发表于 2016-9-21 23:33:42 | 只看该作者 |只看大图 回帖奖励 |倒序浏览 |阅读模式
httpd.ini适合IIS使用,.htaccess适合Apache使用,nginx.conf适合Nginx使用

httpd.ini  举例一个
-----------------------------------------------------------------------------------------------------------
[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP
# duoduo Rewrite规则
RewriteRule ^/index.html$ /index.php
RewriteRule ^/sitemap.html$ /sitemap.php
RewriteRule ^/malllist.html$ /malllist.php
-----------------------------------------------------------------------------------------------------------
转换成 .htaccess  注意看不同点 下次按照这样转换即可。
-----------------------------------------------------------------------------------------------------------
RewriteEngine On
RewriteBase /
# duoduo Rewrite规则
RewriteRule index.html$ /index.php
RewriteRule sitemap.html$ /sitemap.php
RewriteRule malllist.html$ /malllist.php
-----------------------------------------------------------------------------------------------------------
httpd.ini 转换 .htaccess  一般规则说明:
1.
[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
# Protect httpd.ini and httpd.parse.errors files
# from accessing through HTTP
换成:
RewriteEngine On
RewriteBase /
2.
RewriteRule ^/index.html$ /index.php
去掉 ^/
RewriteRule index.html$ /index.php
-----------------------------------------------------------------------------------------------------------
.htaccess  转换成 nginx  注意看不同点 下次按照这样转换即可。
-----------------------------------.htaccess-----------------------------------------------------
RewriteEngine On
RewriteBase /
# duoduo Rewrite规则
RewriteRule index.html$ /index.php
RewriteRule sitemap.html$ /sitemap.php
RewriteRule malllist.html$ /malllist.php
------------------------------------nginx----------------------------------------------------------
location / {
rewrite /index.html$ /index.php last;
rewrite /sitemap.html$ /sitemap.php last;
rewrite /malllist.html$ /malllist.php last;-
----------------------------------------------------------------------------------------------------------
.htaccess  转换成 nginx  说明
-----------------------------------------------------------------------------------------------------------
1.
RewriteEngine On
RewriteBase /
# duoduo Rewrite规则
转换为:
location / {
2.
RewriteRule index.html$ /index.php
转换为:
rewrite /index.html$ /index.php last;
-----------------------------------------------------------------------------------------------------------

送上在线转换的地方:

.htaccess Editor  :http://www.htaccesseditor.com/sc.shtml

把.htaccess中的规则自动转换成nginx

http://www.anilcetin.com/convert-apache-htaccess-to-nginx/

从apache转到iis下,碰到.htacess转换httpd.ini,分享下方法。




在.htacess转换httpd.ini转换结果汇中大家明显看到我们做了修改的几个地方,有颜色的部分就是修改过的,在.htacess转换httpd.ini转换中,就是要让apache和iis理解我们想要它做什么。上面代码不难看出:

首先是对规则的定义要变,从rewrite_module变成isapi_rewrite。

其次是路径要变,.htacess的路径是定义在头部中,而httpd.ini是定义在每行规则里,.htacess转换httpd.ini转

换时将.htacess中^符号换成/,在独立页面前面加上路径/,以我自己理解这个/应该是相对目录的根目录。
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享
您需要登录后才可以回帖 登录 | 会员注册

本版积分规则

锦尚中国源码论坛

聚合标签|锦尚中国,为中国网站设计添动力 ( 鲁ICP备09033200号 ) |网站地图

GMT+8, 2024-4-19 22:08 , Processed in 0.038353 second(s), 20 queries .

带宽由 锦尚数据 提供 专业的数据中心

© 锦尚中国源码论坛 52jscn Inc. 非法入侵必将受到法律制裁 法律顾问:IT法律网 & 褚福省律师 锦尚爱心 版权申诉 版权与免责声明