YOURLS短网址系统nginx伪静态规则

2016年3月29日17:06:44网站建设评论2,389

YOURLS (Your Own URL Shortener) 是一款开源的PHP网址缩短服务程序。使用YOURLS你可以轻松建立属于自己的短网址生成系统且可实时查看每一个短网址的访问统计信息。YOURLS官方只提供了apache的伪静态规则,对于使用nginx环境的用户可以使用以下伪静态规则来实现YOURLS完美使用。文章源自堕落的鱼-https://www.duoluodeyu.com/2319.html

YOURLS安装在根目录下:文章源自堕落的鱼-https://www.duoluodeyu.com/2319.html

  1. location /
  2. {
  3. if (!-f $request_filename){
  4.         set $rule_0 1$rule_0;
  5. }
  6. if (!-d $request_filename){
  7.         set $rule_0 2$rule_0;
  8. }
  9. if ($rule_0 = "21"){
  10.         rewrite ^/([0-9A-Za-z]+)/?$ /yourls-go.php?id=$1 last;
  11. }
  12.         rewrite ^/([0-9A-Za-z]+)\+/?$ /yourls-infos.php?id=$1 last;
  13.         rewrite ^/([0-9A-Za-z]+)\+all/?$ /yourls-infos.php?id=$1&all=1 last;
  14. }

YOURLS安装在子目录下(以go子目录为例)文章源自堕落的鱼-https://www.duoluodeyu.com/2319.html

  1. location /go/
  2. {
  3. if (!-f $request_filename){
  4.        set $rule_0 1$rule_0;
  5. }
  6. if (!-d $request_filename){
  7.        set $rule_0 2$rule_0;
  8. }
  9. if ($rule_0 = "21"){
  10.     rewrite ^/go/([0-9A-Za-z]+)/?$ /go/yourls-go.php?id=$1 last;
  11. }
  12.     rewrite ^/go/([0-9A-Za-z]+)\+/?$ /go/yourls-infos.php?id=$1 last;
  13.     rewrite ^/go/([0-9A-Za-z]+)\+all/?$ /go/yourls-infos.php?id=$1&all=1 last;
  14. }

备注:请根据YOURLS所在子目录将go修改成你所使用的子目录名称。文章源自堕落的鱼-https://www.duoluodeyu.com/2319.html

常用正则表达式汇总 网站建设

常用正则表达式汇总

很多不太懂正则的朋友,在遇到需要用正则校验数据时,往往是在网上去找很久,结果找来的还是不很符合要求。所以我最近把开发中常用的一些正则表达式整理了一下,在这里分享一下。给自己留个底,也给朋友们做个参考。...
匿名

发表评论

匿名网友 填写信息

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定