a href only will send me to subdirecteries and not anywhere else

三世轮回 提交于 2019-12-24 10:15:39

问题


all these links send me to a subdirectery of my site but i cant get them to send me to places like mysite.com, google.com or url.com.

<div id="header">
            <div id="loggedoutmainnav">
                <ul>
                    <li><a href ="<?php echo $_SERVER['SERVER_NAME']; ?>"><?php echo $_SERVER['SERVER_NAME']; ?></a></li>
                    <li><a href ="www.google.com">Google</a></li>
                    <li><a href ="url.com">Url</a> </li>
                    <li><a href ="#">Plans & Pricing</a></li>
                    <li><a href="#">Log in</a></li>
                </ul>
            </div>
        </div>

so if i click on the google button, it will send me to mysite.com/www.google.com


回答1:


<a href ="http://www.google.com">Google</a>

This should work. You need to add "http://" because it's an external link




回答2:


You need to add http:// before the URL for external sites.



来源:https://stackoverflow.com/questions/9204736/a-href-only-will-send-me-to-subdirecteries-and-not-anywhere-else

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!