nginx配置自动跳转

nginx配置自动跳转

阅读更多

希望实现的效果是,用户只要访问域名,自动跳转到index.html页面

原本配置为:

Plain代码 location / { root /users/apple/git_local/YAE/YAE/frontend; index /portal/nail/index.html; } location / {

root /users/apple/git_local/YAE/YAE/frontend;

index /portal/nail/index.html;

}

这样虽然可以达到目的,但是浏览器里的URL还是www.xxx.com。如果页面上有链接使用相对路径,就会发生404错误,所以需要配置为:

Plain代码 rewrite ^/(index.html)?$ portal/nail/index.html redirect; location / { root /users/apple/git_local/YAE/YAE/frontend; index /portal/nail/index.html; } rewrite ^/(index.html)?$ portal/nail/index.html redirect;

location / {

root /users/apple/git_local/YAE/YAE/frontend;

index /portal/nail/index.html;

}

浏览器的URL会变成www.xxx.com/portal/nail/index.html,这样相对路径就能正常访问了

分享到:

UITextField设置leftView的Insets

|

ios app初始化和数据迁移的设计思路

2014-05-15 19:55

浏览 848

评论(0)

  • 查看更多
  • 评论

    发表评论

    您还没有登录,请您登录后再发表评论

    相关文章