Jump to content
Sign in to follow this  
seblondres

Clickable {$_SERVER['SERVER_NAME']}

Recommended Posts

There are many ways to do it.

echo '<a href="' . $_SERVER['SERVER_NAME'] . '">' . $_SERVER['SERVER_NAME'] . '</a>';

Share this post


Link to post
Share on other sites

thanks for your help , it works apart that when I click on the link the page is not found because the url contains the domain name twice e.g. mysite.com/mysite.com

<?php echo '<h1><a href="' . $_SERVER['SERVER_NAME'] . '">' . $_SERVER['SERVER_NAME'] . '</a></h1>';?>

Share this post


Link to post
Share on other sites

 

<?php echo '<h1><a href="http://' . $_SERVER['SERVER_NAME'] . '">' . $_SERVER['SERVER_NAME'] . '</a></h1>';?>

Are you sure you need an <h1> element there?

Share this post


Link to post
Share on other sites

You can target the <a> element with CSS, change font size, weight, color and anything else. If you use <h1> the wrong way search engines will not rank your page correctly for the right searches. Aside from the <title> element, <h1> is one of the first things Google looks at when indexing a page.

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

×
×
  • Create New...