希望实现的效果是,用户只要访问域名,自动跳转到index.html页面
原本配置为:
- 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错误,所以需要配置为:
- 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,这样相对路径就能正常访问了
<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>