2015-09-28 16:36:29 9462次浏览 7条回答 0 悬赏 10 金钱

我在`
main.php


里添加了如下配置项后,

'urlManager' => [

        'enablePrettyUrl' => true,
        'showScriptName' => false,
        'suffix' => '.html',
        'rules' => [
            'login' => '/service/login',
            'signup' => '/service/signup',
            'captcha' => '/service/captcha',
            'logout' => '/service/logout',
        ]
    ],

登陆页面的url变成了:

www.abc.com/login.html

,可nginx提示404,我其它模块又是好的
  • 回答于 2015-09-28 17:34 举报

    rules 里面 'login' => '/service/login'=> 'login' => 'service/login' 斜杠去掉试试。
    不行就把log贴出来。

    3 条回复
    回复于 2015-09-29 10:29 回复

    试过了,没用

    回复于 2015-09-29 13:52 回复

    是不是要在前面加上 ‘GET‘ 或者 ’POST’? 最好把log贴出来

    回复于 2015-10-20 10:19 回复

    .htaccess这个文件有没有。

  • 回答于 2015-09-29 06:48 举报

    不知道你的nginx里面加上隐藏index.php的规则了么?

    location / {
        # Redirect everything that isn't a real file to index.php
        try_files $uri $uri/ /index.php?$args;
    }
    
    1 条回复
    回复于 2015-09-29 10:29 回复

    已经加了的

  • 回答于 2015-10-04 21:45 举报

    我也是。。mark

  • 回答于 2015-11-07 00:18 举报

    'suffix' => '.html',
    去掉呢 我的 gii 不能访问 去掉这个就可以了

  • 回答于 2016-04-12 15:34 举报

    nginx没有开启重写

  • 回答于 2016-07-15 18:30 举报

    你怎么解决的?

  • 回答于 2018-02-08 11:33 举报

    在nginx的配置中的location / 中加上下面的这两行
    location / {

        index index.html index.htm index.php;
    
        if (!-e $request_filename) {
            rewrite . /index.php last;
        }
    

    }

您需要登录后才可以回答。登录 | 立即注册
tgy3300
见习主管

tgy3300

注册时间:2015-03-20
最后登录:2018-09-12
在线时长:19小时53分
  • 粉丝4
  • 金钱10
  • 威望10
  • 积分300

热门问题