【问题标题】:rewrite url using nginx使用 nginx 重写 url
【发布时间】:2012-01-31 07:51:16
【问题描述】:

任何人都可以帮助我,我想从

重写 url

http://localhost/auditsi/cms3/index.phpdirMod=jobseeker&dirAct=myaccount&dirPref=view_front&dirMn=lWU=

http://localhost/auditsi/cms3/jobseeker/myaccount/view_front/lWU=

/auditsi/cms/ 是目录。

我在这里重写:

    location / {
        }

    location /auditsi/cms3/ {
        index index.php index.html;
        rewrite ^(.*)/(.*)/(.*)$ /index.php?dirMod=$1&dirAct=$2&dirPref=$3 break;               
    }

我从 wiki nginx 学习过,但从未成功:(

请帮帮我。

【问题讨论】:

  • 您没有忘记原始网址中的问号吗?
  • ops..对不起,我错了。好的网址是localhost/auditsi/cms3/…,但我的问题是一样的:(

标签: url nginx rewrite


【解决方案1】:

请试试这个:

server {
     rewrite ^/auditsi/cms3/(.*)/(.*)/(.*)$ /index.php?dirMod=$1&dirAct=$2&dirPref=$3 break;

     location {

     }

     location /auditsi/cms3/ {
            index index.php index.html;

     }
 ....
猜你喜欢
  • 2018-02-01
  • 1970-01-01
  • 2020-06-03
  • 1970-01-01
  • 2016-02-07
  • 2015-03-19
  • 2015-12-20
  • 2015-03-08
  • 1970-01-01
相关资源
最近更新 更多