源码论坛,商业源码下载,尽在锦尚中国商业源码论坛
标题:
.htAccess和httpd.ini和Nginx之间的伪静态规则互相转换方法
[打印本页]
作者:
化蝶影澜
时间:
2016-9-21 23:33
标题:
.htAccess和httpd.ini和Nginx之间的伪静态规则互相转换方法
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,分享下方法。
(, 下载次数: 113)
上传
点击文件名下载附件
在.htacess转换httpd.ini转换结果汇中大家明显看到我们做了修改的几个地方,有颜色的部分就是修改过的,在.htacess转换httpd.ini转换中,就是要让apache和iis理解我们想要它做什么。上面代码不难看出:
首先是对规则的定义要变,从rewrite_module变成isapi_rewrite。
其次是路径要变,.htacess的路径是定义在头部中,而httpd.ini是定义在每行规则里,.htacess转换httpd.ini转
换时将.htacess中^符号换成/,在独立页面前面加上路径/,以我自己理解这个/应该是相对目录的根目录。
欢迎光临 源码论坛,商业源码下载,尽在锦尚中国商业源码论坛 (https://bbs.52jscn.com/)
Powered by Discuz! X3.3