phphtmlcodeigniterexternal-links

How to access external link html in CI


I have this Html Code in my CI, it's quite normal ... When i run in localhost it's all fine, but when i host the wbsite

it keeps sending mysite.com/www.google.com instead just wwww.google.com.

am i missing something here ?

<ul>
              <li>
                <a href="www.google.com" class="drop-text">Login</a>
              </li>
              <li>
                <a href="#contact" class="drop-text">Contact Us</a>
              </li>
            </ul>

result expected is www.google.com on url my bar


Solution

  • Your href needs to be https://www.google.com, else your site will be prepended as you are seeing.

    It will think it's a local link.

    So

    <a href="www.google.com" class="drop-text">Login</a>
    

    needs to be

    <a href="https://www.google.com" class="drop-text">Login</a>
    

    So for external links, the http:// or https:// needs to be included in the links url