全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

CeraNetworks网络延迟测速工具IP归属甄别会员请立即修改密码
查看: 2973|回复: 15

求转Nginx伪静态规则

[复制链接]
发表于 2013-1-16 12:19:16 | 显示全部楼层 |阅读模式
  1. RewriteEngine on

  2. RewriteRule ^gallery\/?$ gallery.php [L]
  3. RewriteRule ^gallery\/(new|popular)\/(today|week|month|all)\/([0-9]+)\/?$ gallery.php?order=$1&range=$2&page=$3 [L]

  4. RewriteRule ^([a-zA-Z]+)\/?$ index.php?i=$1 [L,QSA]
  5. RewriteRule ^a\/([a-zA-Z]+)\/?$ index.php?a=$1 [L,QSA]

  6. RewriteRule ^(small|medium|square)\/([a-zA-Z]+)\.([a-z]{3,4})$ php/resize.php?m=$1&a=$2&e=$3 [L]

  7. RewriteCond %{REQUEST_FILENAME} !-f
  8. RewriteRule ^([a-zA-Z]+)\.([a-z]{3,4})$ php/resize.php?m=original&a=$1&e=$2 [L]
复制代码
  好人一生平安,谢谢帮转。  
发表于 2013-1-16 12:23:17 | 显示全部楼层
  1. rewrite ^/gallery/?$ /gallery.php last;
  2. rewrite ^/gallery/(new|popular)/(today|week|month|all)/([0-9]+)/?$ /gallery.php?order=$1&range=$2&page=$3 last;
  3. rewrite ^/([a-zA-Z]+)/?$ /index.php?i=$1 last;
  4. rewrite ^/a/([a-zA-Z]+)/?$ /index.php?a=$1 last;
  5. rewrite ^/(small|medium|square)/([a-zA-Z]+).([a-z]{3,4})$ /php/resize.php?m=$1&a=$2&e=$3 last;
  6. rewrite ^/([a-zA-Z]+).([a-z]{3,4})$ /php/resize.php?m=original&a=$1&e=$2 last;
复制代码
 楼主| 发表于 2013-1-16 12:39:50 | 显示全部楼层
pojtt 发表于 2013-1-16 12:23

这个跟这里http://www.onexin.net/rewrite.php转换的没什么区别啊, \/替换为/而已, 而且还是一样不能用
发表于 2013-1-16 12:46:02 | 显示全部楼层
提示: 作者被禁止或删除 内容自动屏蔽
 楼主| 发表于 2013-1-16 12:54:48 | 显示全部楼层
Nginx达人在哪里
发表于 2013-1-16 12:55:34 | 显示全部楼层
kzhangtao 发表于 2013-1-16 12:54
Nginx达人在哪里

话说那个为啥不行
咱用着可以
 楼主| 发表于 2013-1-16 13:00:18 | 显示全部楼层
pojtt 发表于 2013-1-16 12:55
话说那个为啥不行
咱用着可以

你下载源码试试看, 各种出错。
http://rghost.net/43070497
发表于 2013-1-16 13:01:57 | 显示全部楼层
kzhangtao 发表于 2013-1-16 13:00
你下载源码试试看, 各种出错。
http://rghost.net/43070497

这不是图床那个么
发表于 2013-1-16 13:02:57 | 显示全部楼层
试试这个:
  1. # nginx configuration

  2. location /gallery {
  3.   rewrite ^/gallery\/?$ /gallery.php break;
  4.   rewrite ^/gallery\/(new|popular)\/(today|week|month|all)\/([0-9]+)\/?$ /gallery.php?order=$1&range=$2&page=$3 break;
  5. }

  6. location / {
  7.   rewrite ^/([a-zA-Z]+)\/?$ /index.php?i=$1 break;
  8.   rewrite "^/(small|medium|square)\/([a-zA-Z]+)\.([a-z]{3,4})$" /php/resize.php?m=$1&a=$2&e=$3 break;
  9.   if (!-e $request_filename){
  10.     rewrite "^/([a-zA-Z]+)\.([a-z]{3,4})$" /php/resize.php?m=original&a=$1&e=$2 break;
  11.   }
  12. }

  13. location /a {
  14.   rewrite ^/a\/([a-zA-Z]+)\/?$ /index.php?a=$1 break;
  15. }
复制代码
 楼主| 发表于 2013-1-16 13:03:40 | 显示全部楼层
pojtt 发表于 2013-1-16 13:01
这不是图床那个么

是啊
您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|手机版|小黑屋|全球主机交流论坛

GMT+8, 2024-4-29 03:40 , Processed in 0.299294 second(s), 12 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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