zoukankan      html  css  js  c++  java
  • nginx配置自动跳转

    阅读更多

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

    原本配置为:

    Plain代码  收藏代码
    1. location / {  
    2.     root   /users/apple/git_local/YAE/YAE/frontend;  
    3.     index  /portal/nail/index.html;  
    4. }  

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

    Plain代码  收藏代码
    1. rewrite ^/(index.html)?$ portal/nail/index.html redirect;  
    2.   
    3. location / {  
    4.     root   /users/apple/git_local/YAE/YAE/frontend;  
    5.     index  /portal/nail/index.html;  
    6. }  



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

    <div id="share_weibo">分享到:
      <a data-type="sina" href="javascript:;" title="分享到新浪微博"><img src="/images/sina.jpg"></a>
      <a data-type="qq" href="javascript:;" title="分享到腾讯微博"><img src="/images/tec.jpg"></a>
    </div>
    
    • 2014-05-15 19:55
    • 浏览 848
    • 评论(0)
    •   <li class="last"><a href="https://www.iteye.com/wiki/blog/2070350" target="_blank" class="more">查看更多</a></li>
      </ul>    
      
    评论
  • 相关阅读:
    commons
    Dozer数据对象转换神器
    xstream
    javassist
    JAVA设计模式之单例模式
    单例模式
    OC_自动引用计数器_0x04
    OC_自动引用计数器_0x03
    OC_自动引用计数器_0x02
    OC_自动引用计数器_0x01
  • 原文地址:https://www.cnblogs.com/jpfss/p/10417885.html
Copyright © 2011-2022 走看看