tslqwd 发表于 2011-4-27 08:50:01

关于mymps的伪静态规则怎么写?

RewriteEngine On
RewriteBase /

RewriteRule ^info-id-(+)\.html$ info\.php\?id=$1
RewriteRule ^info-catid-(+)\.html$ info\.php\?catid=$1
RewriteRule ^info-catid-(+)-page-(+)\.html$ info\.php\?catid=$1&page=$2
RewriteRule ^info-catid-(+)-areaid-(+)-page-(+)\.html$ info\.php\?catid=$1&areaid=$2&page=$3

RewriteRule ^news\.html$ news\.php
RewriteRule ^news-id-(+)\.html$ news\.php\?id=$1
RewriteRule ^news-catid-(+)\.html$ news\.php\?catid=$1
RewriteRule ^news-catid-(+)-page-(+)\.html$ news\.php\?catid=$1&page=$2

RewriteRule ^corp\.html$ corp\.php
RewriteRule ^corp-areaid-(+)\.html$ corp\.php\?areaid=$1
RewriteRule ^corp-page-(+)\.html$ corp\.php\?page=$1
RewriteRule ^corp-catid-(+)\.html$ corp\.php\?catid=$1
RewriteRule ^corp-areaid-(+)-page-(+)\.html$ corp\.php\?areaid=$1&page=$2
RewriteRule ^corp-catid-(+)-page-(+)\.html$ corp\.php\?catid=$1&page=$2
RewriteRule ^corp-catid-(+)-areaid-(+)\.html$ corp\.php\?catid=$1&areaid=$2
RewriteRule ^corp-catid-(+)-areaid-(+)-page-(+)\.html$ corp\.php\?catid=$1&areaid=$2&page=$3

RewriteRule ^aboutus\.html$ about\.php\?part=aboutus
RewriteRule ^aboutus-id-(+)\.html$ about\.php\?part=aboutus&id=$1
RewriteRule ^announce\.html$ about\.php\?part=announce&id=$1
RewriteRule ^faq\.html$ about\.php\?part=faq
RewriteRule ^faq-id-(+)\.html$ about\.php\?part=faq&id=$1
RewriteRule ^friendlink\.html$ about\.php\?part=friendlink

RewriteRule ^space/(.+)\/$ space\.php\?user=$1
RewriteRule ^space/(.+)\/about_us.html$ space\.php\?user=$1&part=about_us
RewriteRule ^space/(.+)\/info.html$ space\.php\?user=$1&part=info
RewriteRule ^space/(.+)\/album.html$ space\.php\?user=$1&part=album
RewriteRule ^space/(.+)\/contactus.html$ space\.php\?user=$1&part=contactus
RewriteRule ^space/(.+)\/comment.html$ space\.php\?user=$1&part=comment
RewriteRule ^space/(.+)\/guestbook.html$ space\.php\?user=$1&part=guestbook
RewriteRule ^space/(.+)\/(+)\/page-(+).html$ space\.php\?user=$1&part=$2&page=$3
RewriteRule ^space/(.+)\/document-typeid-(+).html$ space\.php\?user=$1&part=document&typeid=$2
RewriteRule ^space/(.+)\/document-id-(+).html$ space\.php\?user=$1&part=document&id=$2

这是官方的apache的伪静态规则,在网上转换后是这样的

rewrite ^/info-id-(+)\.html$ /info\.php\?id=$1;

rewrite ^/info-catid-(+)\.html$ /info\.php\?catid=$1;

rewrite ^/info-catid-(+)-page-(+)\.html$ /info\.php\?catid=$1&page=$2;

rewrite ^/info-catid-(+)-areaid-(+)-page-(+)\.html$ /info\.php\?catid=$1&areaid=$2&page=$3;

rewrite ^/news\.html$ /news\.php;

rewrite ^/news-id-(+)\.html$ /news\.php\?id=$1;

rewrite ^/news-catid-(+)\.html$ /news\.php\?catid=$1;

rewrite ^/news-catid-(+)-page-(+)\.html$ /news\.php\?catid=$1&page=$2;

rewrite ^/corp\.html$ /corp\.php;

rewrite ^/corp-areaid-(+)\.html$ /corp\.php\?areaid=$1;

rewrite ^/corp-page-(+)\.html$ /corp\.php\?page=$1;

rewrite ^/corp-catid-(+)\.html$ /corp\.php\?catid=$1;

rewrite ^/corp-areaid-(+)-page-(+)\.html$ /corp\.php\?areaid=$1&page=$2;

rewrite ^/corp-catid-(+)-page-(+)\.html$ /corp\.php\?catid=$1&page=$2;

rewrite ^/corp-catid-(+)-areaid-(+)\.html$ /corp\.php\?catid=$1&areaid=$2;

rewrite ^/corp-catid-(+)-areaid-(+)-page-(+)\.html$ /corp\.php\?catid=$1&areaid=$2&page=$3;

rewrite ^/aboutus\.html$ /about\.php\?part=aboutus;

rewrite ^/aboutus-id-(+)\.html$ /about\.php\?part=aboutus&id=$1;

rewrite ^/announce\.html$ /about\.php\?part=announce&id=$1;

rewrite ^/faq\.html$ /about\.php\?part=faq;

rewrite ^/faq-id-(+)\.html$ /about\.php\?part=faq&id=$1;

rewrite ^/friendlink\.html$ /about\.php\?part=friendlink;

rewrite ^/space/(.+)\/$ /space\.php\?user=$1;

rewrite ^/space/(.+)\/about_us.html$ /space\.php\?user=$1&part=about_us;

rewrite ^/space/(.+)\/info.html$ /space\.php\?user=$1&part=info;

rewrite ^/space/(.+)\/album.html$ /space\.php\?user=$1&part=album;

rewrite ^/space/(.+)\/contactus.html$ /space\.php\?user=$1&part=contactus;

rewrite ^/space/(.+)\/comment.html$ /space\.php\?user=$1&part=comment;

rewrite ^/space/(.+)\/guestbook.html$ /space\.php\?user=$1&part=guestbook;

rewrite ^/space/(.+)\/(+)\/page-(+).html$ /space\.php\?user=$1&part=$2&page=$3;

rewrite ^/space/(.+)\/document-typeid-(+).html$ /space\.php\?user=$1&part=document&typeid=$2;

rewrite ^/space/(.+)\/document-id-(+).html$ /space\.php\?user=$1&part=document&id=$2;


不过测试不能用,重启服务报错误
: pattern "^/(.*)/announce\.html$" has less captures than referrenced in substitution "/$1/about.php\?part=announce&id=$2" in /usr/local/nginx/conf/mymps.conf:19

把这行删除后不报错了,但是没有生效
哪有高手帮帮忙看看有什么问题,谢谢了

licess 发表于 2011-4-27 10:22:23

找mymps官方要个吧

tslqwd 发表于 2011-4-27 10:27:23

回复 2# 的帖子

问过了,说没有,服务很差劲

licess 发表于 2011-4-27 10:45:00

rewrite^/info-id-(+)\/$ /public/info.php?id=$1;
rewrite^/info-catid-(+)-page-(+)\/$ /public/info.php?catid=$1&page=$2;
rewrite^/info-catid-(+)-areaid-(+)-page-(+)\/$ /public/info.php?catid=$1&areaid=$2&page=$3;
rewrite^/aboutus\/$ /public/about.php?part=aboutus;
rewrite^/aboutus-id-(+)\/$ /public/about.php?part=aboutus&id=$1;
rewrite^/announce-page-(+)\/$ /public/about.php?part=announce&page=$1;
rewrite^/announce-id-(+)\/$ /public/about.php?part=announce&id=$1;
rewrite^/faq\/$ /public/about.php?part=faq;
rewrite^/faq-id-(+)\/$ /public/about.php?part=faq&id=$1;
rewrite^/friendlink\/$ /public/about.php?part=friendlink;
rewrite^/friendlink-action-apply\/$ /public/about.php?part=friendlink&action=apply;
rewrite^/guestbook-page-(+)\/$ /public/about.php?part=guestbook&page=$1;
rewrite^/guestbook-action-write\/$ /public/about.php?part=guestbook&action=write;
rewrite^/space-(+)\/$ /public/space.php?user=$1;
网上找的你试试
页: [1]
查看完整版本: 关于mymps的伪静态规则怎么写?