44425

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

Question:

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

Answer1:

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

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

Answer2:

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

Recommend

  • Indent list items with floating image: problem
  • HTML ordered list indent to keep original numbering
  • jQuery e.stopPropagation() - how to use without breaking dropbox functionality altogether?
  • Dropdown menu items hides behind main menu in bootstrap customized navigation bar
  • keydown event triggered only once
  • ember js subviews and didinsertelement event
  • How to activate JS data-filter when page loads?
  • jQuery-Marquee only working in Firefox
  • acts_as_taggable_on Tags added twice
  • Touch events over two dom elements?
  • JQuery Add class to certain list item
  • Jquery Show & ScrollTop (or ScrollTo)
  • Function JavaScript : on Menu CSS HTML
  • Can't delete li from to-do list
  • Cut the background to expose the layer below
  • saving file generated by TCPDF
  • How to view images from protected folder with php?
  • Textfile Structure (tables)
  • How do I pass the string value parameter of the selected list item from an auto-populated dropdown l
  • Jquery UI tool tip close icon
  • FileReader+canvas image loading problem
  • Using jQuery closest() method with class selector
  • Insert into database using onclick function
  • Deselecting radio buttons while keeping the View Model in synch
  • Why HTML5 Canvas with a larger size stretch a drawn line?
  • HTML download movie download link
  • Why doesn't :active or :focus work on text links in webkit? (safari & chrome)
  • vba code to select only visible cells in specific column except heading
  • Upload files with Ajax and Jquery
  • Do I've to free mysql result after storing it?
  • Jquery - Jquery Wysiwyg return html as a string
  • A cron job substitute?
  • How to delete a row from a dynamic generate table using jquery?
  • json Serialization in asp
  • Rails 2: use form_for to build a form covering multiple objects of the same class
  • How to stop GridView from loading again when I press back button?
  • Observable and ngFor in Angular 2
  • How to Embed XSL into XML
  • UserPrincipal.Current returns apppool on IIS
  • Conditional In-Line CSS for IE and Others?