页面没有正确重定向 - Web2py Admin

时间:2015-02-14 12:41:23

标签: apache .htaccess web2py

当我访问https://www.myapp.com时,该网站运作正常。我可以毫无问题地访问每个页面,包括https://www.myapp.com/admin。在管理员界面上输入密码并单击“提交”后,页面会重定向到https://www.myapp.com/admin/site,并显示以下错误:The page isn't redirecting properly

/home/www-data/web2py/routes.py

routers = dict(
        BASE= dict(
            default_application = 'myapp',
            default_controller = 'default',
            default_function = 'index',
            functions = ['function1', 'function2', ...],
                   )
    )

/etc/apache2/sites-available/default.conf

<VirtualHost *:80>

   RewriteEngine On
   RewriteCond %{HTTPS} !=on
   RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]

  CustomLog /var/log/apache2/access.log common
  ErrorLog /var/log/apache2/error.log
</VirtualHost>

/etc/apache2/sites-available/web2py.conf

正如文档中所示:http://www.web2py.com/books/default/chapter/34/13/deployment-recipes

可能导致这种情况发生的原因是什么?

1 个答案:

答案 0 :(得分:0)

我通过从基于参数的系统切换到基于模式的routes_in和routes_out解决方案解决了这个问题。我为每个页面定义了路由,然后使用$anything添加了管理路由以公开admin。

routes_in = (
  ('/', '/myapp/default/index'),
  ('/admin/$anything', '/admin/$anything'),
  ...
)
相关问题