VPS侦探论坛

 找回密码
 注册
查看: 9213|回复: 3

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

[复制链接]
发表于 2011-4-27 08:50:01 | 显示全部楼层 |阅读模式

RewriteEngine On
RewriteBase /

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

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

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

RewriteRule ^aboutus\.html$ about\.php\?part=aboutus
RewriteRule ^aboutus-id-([0-9]+)\.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-([0-9]+)\.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/(.+)\/([a-z]+)\/page-([0-9]+).html$ space\.php\?user=$1&part=$2&page=$3
RewriteRule ^space/(.+)\/document-typeid-([0-9]+).html$ space\.php\?user=$1&part=document&typeid=$2
RewriteRule ^space/(.+)\/document-id-([0-9]+).html$ space\.php\?user=$1&part=document&id=$2

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

rewrite ^/aboutus-id-([0-9]+)\.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-([0-9]+)\.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/(.+)\/([a-z]+)\/page-([0-9]+).html$ /space\.php\?user=$1&part=$2&page=$3;

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

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


不过测试不能用,重启服务报错误
[emerg]: 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

把这行删除后不报错了,但是没有生效
哪有高手帮帮忙看看有什么问题,谢谢了
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2011-4-27 10:22:23 | 显示全部楼层


找mymps官方要个吧
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
 楼主| 发表于 2011-4-27 10:27:23 | 显示全部楼层

回复 2# 的帖子


问过了,说没有,服务很差劲
美国VPS推荐: 遨游主机LinodeLOCVPS主机云搬瓦工80VPSVultr美国VPS主机中国VPS推荐: 阿里云腾讯云。LNMP付费服务(代装/问题排查)QQ 503228080
发表于 2011-4-27 10:45:00 | 显示全部楼层



  1. rewrite  ^/info-id-([0-9]+)\/$ /public/info.php?id=$1;
  2. rewrite  ^/info-catid-([0-9]+)-page-([0-9]+)\/$ /public/info.php?catid=$1&page=$2;
  3. rewrite  ^/info-catid-([0-9]+)-areaid-([0-9]+)-page-([0-9]+)\/$ /public/info.php?catid=$1&areaid=$2&page=$3;
  4. rewrite  ^/aboutus\/$ /public/about.php?part=aboutus;
  5. rewrite  ^/aboutus-id-([0-9]+)\/$ /public/about.php?part=aboutus&id=$1;
  6. rewrite  ^/announce-page-([0-9]+)\/$ /public/about.php?part=announce&page=$1;
  7. rewrite  ^/announce-id-([0-9]+)\/$ /public/about.php?part=announce&id=$1;
  8. rewrite  ^/faq\/$ /public/about.php?part=faq;
  9. rewrite  ^/faq-id-([0-9]+)\/$ /public/about.php?part=faq&id=$1;
  10. rewrite  ^/friendlink\/$ /public/about.php?part=friendlink;
  11. rewrite  ^/friendlink-action-apply\/$ /public/about.php?part=friendlink&action=apply;
  12. rewrite  ^/guestbook-page-([0-9]+)\/$ /public/about.php?part=guestbook&page=$1;
  13. rewrite  ^/guestbook-action-write\/$ /public/about.php?part=guestbook&action=write;
  14. rewrite  ^/space-([a-z,0-9\-]+)\/$ /public/space.php?user=$1;  
复制代码

网上找的你试试
Linux下Nginx+MySQL+PHP自动安装工具:https://lnmp.org
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|Archiver|VPS侦探 ( 鲁ICP备16040043号-1 )

GMT+8, 2024-9-20 08:52 , Processed in 0.025878 second(s), 16 queries .

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表