淘主机论坛

 找回密码
 成为淘友

QQ登录

只需一步,快速开始

KT服务器促销中 100M带宽 10T流量 超值传送门:会员注册及发帖规则 发帖看过来
查看: 2925|回复: 1

[主机软件] whmcs在Nginx服务器下的伪静态规则写法

[复制链接]
发表于 2012-12-15 11:53:10 | 显示全部楼层 |阅读模式
whmcs的授权比较贵,所以在自己服务器上用whmcs的朋友估计也都用Apache了,那这个文章对你就没有意义了。

但醒醒在nginx的vps上安装破解版whmcs用于测试学习,可能也有朋友跟我一样在nginx下用,就会碰到伪静态的问题,默认whmcs只提供了apache的伪静态,所以在nginx下用就需要自己写伪静态了。
代码如下:

  1. # Announcements
  2. rewrite ^/announcements/([0-9]+)/[a-zA-Z0-9_-]+.html$ /announcements.php?id=$1 last;
  3. rewrite ^/announcements$ /announcements.php last;

  4. # Downloads
  5. rewrite ^/downloads/([0-9]+)/([^/]*)$ /downloads.php?action=displaycat&catid=$1 last;
  6. rewrite ^/downloads$ /downloads.php last;

  7. # Knowledgebase
  8. rewrite ^/knowledgebase/([0-9]+)/[a-zA-Z0-9_-]+.html$ /knowledgebase.php?action=displayarticle&id=$1 last;
  9. rewrite ^/knowledgebase/([0-9]+)/([^/]*)$ /knowledgebase.php?action=displaycat&catid=$1 last;
  10. rewrite ^/knowledgebase$ /knowledgebase.php last;
复制代码
你可别跟我说你不知道上面的nginx伪静态代码你不知道加到哪里……
 楼主| 发表于 2012-12-15 11:59:18 | 显示全部楼层

WHMCS的htaccess规则 apache

apache下的规则,请确保放到网站根目录下的htaccess.txt修改为 .htaccess
  1. RewriteEngine On

  2. # Announcements
  3. RewriteRule ^announcements/([0-9]+)/[a-z0-9_-]+\.html$ ./announcements.php?id=$1 [L,NC]
  4. RewriteRule ^announcements$ ./announcements.php [L,NC]

  5. # Downloads
  6. RewriteRule ^downloads/([0-9]+)/([^/]*)$ ./downloads.php?action=displaycat&catid=$1 [L,NC]
  7. RewriteRule ^downloads$ ./downloads.php [L,NC]

  8. # Knowledgebase
  9. RewriteRule ^knowledgebase/([0-9]+)/[a-z0-9_-]+\.html$ ./knowledgebase.php?action=displayarticle&id=$1 [L,NC]
  10. RewriteRule ^knowledgebase/([0-9]+)/([^/]*)$ ./knowledgebase.php?action=displaycat&catid=$1 [L,NC]
  11. RewriteRule ^knowledgebase$ ./knowledgebase.php [L,NC]
复制代码
您需要登录后才可以回帖 登录 | 成为淘友

本版积分规则

小黑屋|手机版|Archiver|淘主机

GMT+8, 2024-11-23 11:14

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

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