开发者社区> 问答> 正文

httpd.ini转成.htaccess有会的大神吗?帮一下


LINUX真的用不来啊,亲,
httpd.ini转成.htaccess




[ISAPI_Rewrite]
# 3600 = 1 hour
CacheClockRate 3600
RepeatLimit 32
RewriteRule /([a-z0-9~%~.~ ] )/index.html  /index.php\?$1 [I]
RewriteRule /([a-z0-9~%~.~ ] )/index([0-9] ).html /index.php\?$1&page=$2 [I]
RewriteRule /([a-z0-9~%~.~ ] )/a.html  /index.php\?$1/$2 [I]
RewriteRule /([a-z0-9~%~.~ ] )/a([0-9] ).html  /index.php\?$1/$2 [I]
RewriteRule /([a-z0-9~%~.~ ] )/a([0-9] ).html\?(.*)  /index.php\?$1/$2&$3 [I]
RewriteRule /([a-z0-9~%~.~ ] )/index.html\?(.*)  /index.php\?$1&$2 [I]
RewriteRule ^(.*)/u/([0-9] )/(.*)$   /index.php\?u&$2&$3 [I]
RewriteRule ^(.*)/u/([0-9] )/(.*)/$  /index.php\?u&$2&$3 [I]
RewriteRule ^(.*)/u/([0-9] )$   /index.php\?u&$2 [I]
RewriteRule ^(.*)/u/([0-9] )/$   /index.php\?u&$2 [I]
RewriteRule /([a-z0-9~%~.~ ] )/index.html\?(.*)  /index.php\?$1&$2 [I]
RewriteRule /([a-z0-9~%~.~ ] )/index([0-9] ).html\?(.*)  /index.php\?$1&page=$2&$2 [I]

展开
收起
zhugege 2013-06-27 09:48:22 9816 0
4 条回答
写回答
取消 提交回答
  • 2013-06-28 07:25:58
    赞同 展开评论 打赏
  • Rehttpd.ini转成.htaccess有会的大神吗?帮一下


    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule /([a-z0-9~%~.~ ] )/index.html  /index.php?$1 [I]
    RewriteRule /([a-z0-9~%~.~ ] )/index([0-9] ).html /index.php?$1&page=$2 [I]
    RewriteRule /([a-z0-9~%~.~ ] )/a.html  /index.php?$1/$2 [I]
    RewriteRule /([a-z0-9~%~.~ ] )/a([0-9] ).html  /index.php?$1/$2 [I]
    RewriteRule /([a-z0-9~%~.~ ] )/a([0-9] ).html\?(.*)  /index.php?$1/$2&$3 [I]
    RewriteRule /([a-z0-9~%~.~ ] )/index.html\?(.*)  /index.php?$1&$2 [I]
    RewriteRule ^(.*)/u/([0-9] )/(.*)$   /index.php?u&$2&$3 [I]
    RewriteRule ^(.*)/u/([0-9] )/(.*)/$  /index.php?u&$2&$3 [I]
    RewriteRule ^(.*)/u/([0-9] )$   /index.php?u&$2 [I]
    RewriteRule ^(.*)/u/([0-9] )/$   /index.php?u&$2 [I]
    RewriteRule /([a-z0-9~%~.~ ] )/index.html?(.*)  /index.php?$1&$2 [I]
    RewriteRule /([a-z0-9~%~.~ ] )/index([0-9] ).html?(.*)  /index.php?$1&page=$2&$2 [I]
    </IfModule>

    我没有测试,因为你这里多了好多/和\个符号,我给你把我的文件贴出来。你参考一下。
    httpd.ini与.htaccess不同的是的.httpd.ini的?号前需加 \ ,
    .htacess内容如下:
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule ^index.html$ index.php
    RewriteRule ^article-(\d )-(\d ).html$ article.php?id=$2&channel_id=$1
    RewriteRule ^news-(\d ).html$ news.php?channel_id=$1
    RewriteRule ^news_view-(\d )-(\d ).html$ news_view.php?id=$2&channel_id=$1
    RewriteRule ^product-([a-z0-9\-] ).html$ product.php?channel_id=$1
    </IfModule>

    httpd.ini内容如下:

    [ISAPI_Rewrite]

    # 3600 = 1 hour
    CacheClockRate 3600

    RepeatLimit 32

    # Protect httpd.ini and httpd.parse.errors files
    # from accessing through HTTP
    RewriteRule ^/index.html$ /index.php
    RewriteRule ^/article-(\d )-(\d ).html$ /article.php\?id=$2&channel_id=$1
    RewriteRule ^/news-(\d ).html$ /news.php\?channel_id=$1
    RewriteRule ^/news_1-(\d ).html$ /news_1.php\?channel_id=$1
    RewriteRule ^/news_view-(\d )-(\d ).html$ /news_view.php\?id=$2&channel_id=$1
    RewriteRule ^/product-([a-z0-9\-] ).html$ /product.php\?channel_id=$1
    RewriteRule ^/product1-([a-z0-9\-] ).html$ /product1.php\?channel_id=$1
    RewriteRule ^/product_show-(\d )-(\d ).html$ /product_show.php\?id=$2&channel_id=$1
    2013-06-27 18:11:14
    赞同 展开评论 打赏
  • Rehttpd.ini转成.htaccess有会的大神吗?帮一下
    这个嘛,不懂啊
    2013-06-27 10:35:51
    赞同 展开评论 打赏
  • 不懂,这个是不是dz的
    2013-06-27 10:33:40
    赞同 展开评论 打赏
问答分类:
问答地址:
问答排行榜
最热
最新

相关电子书

更多
低代码开发师(初级)实战教程 立即下载
冬季实战营第三期:MySQL数据库进阶实战 立即下载
阿里巴巴DevOps 最佳实践手册 立即下载