全球主机交流论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

IP归属甄别会员请立即修改密码
查看: 3777|回复: 15
打印 上一主题 下一主题

求转Nginx伪静态规则

[复制链接]
跳转到指定楼层
1#
发表于 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]
复制代码
  好人一生平安,谢谢帮转。  
16#
 楼主| 发表于 2013-1-16 15:28:07 | 只看该作者
求帮助
15#
 楼主| 发表于 2013-1-16 14:41:31 | 只看该作者
14#
 楼主| 发表于 2013-1-16 13:19:54 | 只看该作者
lonefly 发表于 2013-1-16 13:16
  1. nginx not runningnginx: [emerg] directive "rewrite" is not terminated by ";" in /usr/local/nginx/conf/demo.conf:5
复制代码
13#
发表于 2013-1-16 13:16:41 | 只看该作者
  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. if (!-f $request_filename){
  7.         set $rule_5 1$rule_5;
  8. }
  9. if ($rule_5 = "1"){
  10.         rewrite ^/([a-zA-Z]+)\\.([a-z]{3,4})$ /php/resize.php?m=original&a=$1&e=$2 last;
  11. }
复制代码
12#
 楼主| 发表于 2013-1-16 13:05:16 | 只看该作者
ihosting 发表于 2013-1-16 13:02
试试这个:
  1. Restarting nginx daemon: nginxnginx: [emerg] unknown directive "range=$2&amp" in /usr/local/nginx/conf/demo.conf:5
复制代码
11#
发表于 2013-1-16 13:04:41 | 只看该作者
个人认为Nginx始终还不够成熟,伪静也不太好操作!
10#
 楼主| 发表于 2013-1-16 13:03:40 | 只看该作者
pojtt 发表于 2013-1-16 13:01
这不是图床那个么

是啊
9#
发表于 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. }
复制代码
8#
发表于 2013-1-16 13:01:57 | 只看该作者
kzhangtao 发表于 2013-1-16 13:00
你下载源码试试看, 各种出错。
http://rghost.net/43070497

这不是图床那个么
您需要登录后才可以回帖 登录 | 注册

本版积分规则

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

GMT+8, 2025-9-29 04:08 , Processed in 0.730923 second(s), 13 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

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