baike 发表于 2013-4-17 22:16:27

规则转换后重启还是不起作用

规则转换后重启还是不起作用                                                                                                                                                                                                                                                                                                                        阿帕奇的规则
RewriteRule ^single/(+_**).html$ single.php\?f=$1
RewriteRule ^like\/(+)$ like.php\?id=$1
RewriteRule ^topic\/+\/(+_**)\.html$ art.php\?id=$1
RewriteRule ^+\/+(+)$ topic.php\?id=$1
RewriteRule ^(+_**)\.html$ type.php\?id=$1
RewriteRule ^+\/+(+_**)\.html$ topic_list.php\?id=$1

我转换后的
location / { rewrite ^/single/(+_**).html$ /single.php?f=$1;
    rewrite ^/like/(+)$ /like.php?id=$1;
    rewrite ^/topic/+/(+_**).html$ /art.php?id=$1;
    rewrite ^/+/+(+)$ /topic.php?id=$1;
    rewrite ^/(+_**).html$ /type.php?id=$1;
    rewrite ^/+/+(+_**).html$ /topic_list.php?id=$1;
    }
/etc/init.d/nginx start 后 访问依然404 求解

licess 发表于 2013-4-18 11:07:19

可能规则还是有问题

baike 发表于 2013-4-19 13:05:22

location / {
        rewrite ^/single/(+_**).html$ /single.php?f=$1;
        rewrite ^/like/(+)$ /like.php?id=$1;
        rewrite ^/+/+/(+_**).html$ /art.php?id=$1;
        rewrite ^/+/+(+)$ /topic.php?id=$1;
        rewrite ^/(+_**).html$ /type.php?id=$1;
        rewrite ^/+/+(+_**).html$ /topic_list.php?id=$1;
}
这样就OK了
页: [1]
查看完整版本: 规则转换后重启还是不起作用