rewrite nginx
2015-07-02 17:38
501 查看
两个条件,组合控制
# if ($query_string ~* "mod=viewthread&tid=([0-9]+)((&highlight=(.*))|(&extra=(.*)))?$")# {
# set $itid $1;
# rewrite ^([^\.]*)/forum\.php$ http://xxx.xxx.com/thread-$itid-1-1.html? permanent;
# }
set $has_authorid '0';
set $itid '0';
if ($query_string ~* "&authorid=")
{
set $has_authorid '1';
}
if ($query_string ~* "mod=viewthread&tid=([0-9]+)((&highlight=(.*))|(&extra=(.*)))?$")
{
set $itid $1;
}
set $redirect_thread "$has_authorid$itid";
if ($redirect_thread ~ '0([1-9]\d+)')
{
rewrite ^([^\.]*)/forum\.php$ http://xxx.xxx.com/thread-$itid-1-1.html? permanent;
}
相关文章推荐
- 使用nginx后如何在web应用中获取用户ip及原理解释
- nginx配置
- Windows下配置nginx+php(wnmp)
- Nagios 监控Nginx和php-fpm
- Nginx 网址
- Nginx屏蔽访问过于频繁的IP
- Nginx 配置虚拟机
- nginx做负载均衡器以及proxy缓存配置 - SegmentFault
- Nginx负载均衡
- Nginx下配置pathinfo及ThinkPHP的URL Rewrite模式支持
- Nginx配置PATHINFO隐藏thinkphp index.php
- Nginx 配置虚拟机
- Ubuntu下Nginx配置ThinkPHP的Pathinfo和URl Rewrite模式
- Nginx配置支持ThinkPHP的PATH_INFO
- 使用nginx的proxy_cache做网站缓存
- Nginx下支持Thinkphp URL Rewrite的配置示例
- Nginx启动、重启失败的一般解决方法和步骤
- 比较完整的Nginx配置文件nginx.conf常用参数中文详解
- nginx+lua+GraphicsMagick实现图片自动缩放功能(强烈推荐)
- [nginx] 由Lua 粘合的Nginx生态环境-- agentzh tech-club.org