Nginx的WHMCS 7.8友好URL配置

    选择打赏方式

gCMQ7L4aJB5DqhP.png

大家在使用WHMCS系统中会发现后台有一个友好的 URL功能可以进行配置,也就是我们通常来说的伪静态规则

我们为什么要添加SEO友好URL呢?
答:友好的URL既对用户来说看起来不错,更易于记忆,还可以帮助搜索引擎(例如Google,Baidu)更好地了解您的网站。

程序本身是有这个功能的,并且你在更改设置的同时就会帮你将伪静态文件给替换了,可虽替换是替换了,但他替换的是Apache的伪静态,在使用Nginx的服务器上是不起作用的!

这就让我十分纳闷了,这根本就是设置了等于没设置啊,于是我就在搜索引擎中各种搜索,发现都是很旧的版本的规则,好吧,没有办法,只能自己上了,傲世我花费了一点时间,给大家搞到了完整的Nginx rewrite,下面我就分享给大家:

注:当前使用的版本为7.8.3,亲测可用,不出意外会持续更新本页,如因为自身原因不会配置导致不可用的,与我无瓜,请自行绕道!谢谢!

# WHMCS 伪静态配置
# WHMCS更新时,请确保在 https://www.recho.cn/whmcs_nginx_rewrite.html 获得最新的配置
    location ~ /announcements/?(.*)$ {
        rewrite ^/(.*)$ /index.php?rp=/announcements/$1;
    }

    location ~ /download/?(.*)$ {
        rewrite ^/(.*)$ /index.php?rp=/download$1;
    }

    location ~ /knowledgebase/?(.*)$ {
        rewrite ^/(.*)$ /index.php?rp=/knowledgebase/$1;
    }

    location ~ /store/ssl-certificates/?(.*)$ {
        rewrite ^/(.*)$ /index.php?rp=/store/ssl-certificates/$1;
    }

    location ~ /store/sitelock/?(.*)$ {
        rewrite ^/(.*)$ /index.php?rp=/store/sitelock/$1;
    }

    location ~ /store/website-builder/?(.*)$ {
        rewrite ^/(.*)$ /index.php?rp=/store/website-builder/$1;
    }

    location ~ /store/order/?(.*)$ {
        rewrite ^/(.*)$ /index.php?rp=/store/order/$1;
    }

    location ~ /cart/domain/renew/?(.*)$ {
        rewrite ^/(.*)$ /index.php?rp=/cart/domain/renew$1;
    }

    location ~ /account/paymentmethods/?(.*)$ {
        rewrite ^/(.*)$ /index.php?rp=/account/paymentmethods$1;
    }

    location ~ /password/reset/?(.*)$ {
        rewrite ^/(.*)$ /index.php?rp=/password/reset/$1;
    }

    location ~ /account/security/?(.*)$ {
        rewrite ^/(.*)$ /index.php?rp=/account/security$1;
    }

    location ~ /subscription?(.*)$ {
        rewrite ^/(.*)$ /index.php?rp=/subscription$1;
    }

#社交媒体授权

    location ~ /auth/provider/google_signin/finalize/?(.*)$ {
        rewrite ^/(.*)$ /index.php?rp=auth/provider/google_signin/finalize$1;
    }

#WHMCS 后台

    location ~ /admin/(addons|apps|search|domains|help/license|services|setup|utilities/system/php-compat)(.*) {
        rewrite ^/(.*)$ /admin/index.php?rp=/admin/$1$2 last; 
    }

    location ~ /admin/client/?(.*)/paymethods/?(.*)$ {
        rewrite ^/(.*)$ /admin/index.php?rp=/client/?(.*)/paymethods/$1;
    }

    location ~ /admin/setup/auth/?(.*)$ {
        rewrite ^/(.*)$ /admin/index.php?rp=/setup/auth/$1;
    }

    location ~ /admin/client/?(.*)/tickets/?(.*)$ {
        rewrite ^/(.*)$ /admin/index.php?rp=/client/?(.*)/tickets/$1;
    }

    location ~ /admin/client/?(.*)/invoice/?(.*)/capture/?(.*)$ {
        rewrite ^/(.*)$ /admin/index.php?rp=/client/?(.*)/invoice/?(.*)/capture/$1;
    }

    location ~ /admin/account/security/two-factor/?(.*)$ {
        rewrite ^/(.*)$ /admin/index.php?rp=/admin/account/security/two-factor/$1;
    }

    location ~ /admin/search/intellisearch?(.*)$ {
        rewrite ^/(.*)$ /admin/index.php?rp=/search/intellisearch/$1;
    }

#WHMCS 防扒皮

    location ~* .(tpl|inc|cfg)$ {
        deny all;
    }

# WHMCS 伪静态配置结束
版权声明:若无特殊注明,本文为《傲世》原创,转载请保留文章出处。
本文链接:https://www.recho.cn/whmcs_nginx_rewrite.html
正文到此结束

热门推荐

发表吐槽

匿名评论 请叫我雷锋~

你还可以输入 250 / 250 个字

呵呵 哈哈 吐舌 开心 笑眼 可怜 乖 啊 你懂得 不高兴 生气 汗 黑线 哭 真棒 阴险 鄙视 酷 滑稽 纳尼 疑问 委屈 惊讶 勉强

评论信息框
可使用QQ号实时获取头像自动填写

私密评论

吃奶的力气提交吐槽中...


竟然没有人吐槽,快赶紧抢沙发吧!