V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
NGINX
NGINX Trac
3rd Party Modules
Security Advisories
CHANGES
OpenResty
ngx_lua
Tengine
在线学习资源
NGINX 开发从入门到精通
NGINX Modules
ngx_echo
886106
V2EX  ›  NGINX

小白一个,请教大神帮忙转换下 apache 配置,感谢!

  •  
  •   886106 · 2016-09-25 14:22:43 +08:00 · 2815 次点击
    这是一个创建于 2768 天前的主题,其中的信息可能已经有所发展或是发生改变。
    因为对 nginx 不了解,希望有大大帮忙下感谢~

    RewriteEngine On
    RewriteBase /cp
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^([0-9a-zA-Z]+)$ /index.php?type=$1 [L]
    RewriteRule ^([0-9a-zA-Z]+)/(\w+)$ /index.php?type=$1&web=$2 [L]
    RewriteRule ^([0-9a-zA-Z]+)/(\w+)/(\w+)$ /index.php?type=$1&web=$2&page=$3 [L]
    RewriteRule ^([0-9a-zA-Z]+)/(\w+)/(\w+)/(\w+)$ /index.php?type=$1&web=$2&page=$3&pid=$4 [L]
    Options -Indexes
    5 条回复    2016-09-26 18:06:21 +08:00
    lhbc
        1
    lhbc  
       2016-09-25 15:01:00 +08:00 via iPhone   ❤️ 1
    这是什么程序?
    目测这代码有好多年了,估计搜一下就有。
    sherlocktheplant
        2
    sherlocktheplant  
       2016-09-25 15:02:57 +08:00   ❤️ 1
    nginx 原生支持.htdoc
    Kokororin
        3
    Kokororin  
       2016-09-25 15:11:53 +08:00   ❤️ 2
    Dirlllee
        4
    Dirlllee  
       2016-09-25 19:14:32 +08:00 via iPhone   ❤️ 1
    首先百度
    lslqtz
        5
    lslqtz  
       2016-09-26 18:06:21 +08:00   ❤️ 1
    @Kokororin 来自他提供的链接的结果,似乎很 ok 。感谢+1

    location /cp/ {
    if (!-e $request_filename){
    rewrite ^/cp/([0-9a-zA-Z]+)$ /cp/index.php?type=$1 break;
    }
    rewrite ^/cp/([0-9a-zA-Z]+)/(\w+)$ /cp/index.php?type=$1&web=$2 break;
    rewrite ^/cp/([0-9a-zA-Z]+)/(\w+)/(\w+)$ /cp/index.php?type=$1&web=$2&page=$3 break;
    rewrite ^/cp/([0-9a-zA-Z]+)/(\w+)/(\w+)/(\w+)$ /cp/index.php?type=$1&web=$2&page=$3&pid=$4 break;
    }
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   我们的愿景   ·   实用小工具   ·   5841 人在线   最高记录 6543   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 02:01 · PVG 10:01 · LAX 19:01 · JFK 22:01
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.