a href only will send me to subdirecteries and not

2019-07-31 18:07发布

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

2条回答
▲ chillily
2楼-- · 2019-07-31 18:30
<a href ="http://www.google.com">Google</a>

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

查看更多
疯言疯语
3楼-- · 2019-07-31 18:38

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

查看更多
登录 后发表回答