1. 论坛系统升级为Xenforo,欢迎大家测试!
    排除公告

Apache Rewrite的一个例子

本帖由 langyufeng2005-11-20 发布。版面名称:主机讨论

  1. langyufeng

    langyufeng New Member

    注册:
    2005-09-27
    帖子:
    33
    赞:
    0
    看下面的设置就明白拉,是我自己一个站用的

    代码:
    <VirtualHost *.*.*.*>
        ServerAdmin mail
        DocumentRoot /www/www.*.com/www/htdocs
        ServerName www.*.com
        ErrorLog /var/log/www.*.com/error_log
        CustomLog /var/log/www.*.com/access_log common
    
    RewriteEngine On
    
    RewriteRule ^/type([0-9]+).html$ /type.php?typeid=$1   [PT]
    RewriteRule ^/type([0-9]+)page([0-9]+).html$ /type.php?typeid=$1&page=$2   [PT]
    RewriteRule ^/index.html /index.php   [PT]
    RewriteRule ^/list.html /list.php   [PT]
    RewriteRule ^/listpage([0-9]+).html$ /list.php?page=$1   [PT]
    RewriteRule ^/view([0-9]+).html$ /view.php?id=$1   [PT]
    </VirtualHost>
     
  2. jeminy

    jeminy Member

    注册:
    2005-09-27
    帖子:
    975
    赞:
    13
    不明白.......................
     
  3. jeminy

    jeminy Member

    注册:
    2005-09-27
    帖子:
    975
    赞:
    13
    PHP......................哎.............