希望實現的效果是,用戶只要訪問域名,自動跳轉到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;
- }
瀏覽器的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>
評論