Welcome to WebmasterWorld Guest from 54.157.222.62

Forum Moderators: incrediBILL

Message Too Old, No Replies

Links inside php include

   
1:05 am on Feb 4, 2011 (gmt 0)



Hello everyone,

The title of this thread might be misleading, but I'm pretty sure this question belongs to this part of the forum, if not, feel free to say it :)

I created a php include to have it across all of my websites (some sort of community thing to help those sites with lower traffic) and I want it hosted on my main site and include it on all others using the absolute url/path to the included file as well as the css to it, that works fine so far...

My problem is that when I link the sites the absolute URLs get treated as relative so what should go to "https://www.site1.net" goes to "www.mainsite.com/www.site1.net"

This is the included file I'm calling from all pages:
<div id="community">
<span id="community-title">Community:</span>
| <a href="https://www.site1.net/" class="community-link">Site 1</a>
| <a href="https://www.site2.com" class="community-link">Site 2</a>
| <a href="https://www.site3.com" class="community-link">Site 3</a>
</div>


I have linked to absolute URLs before, just not inside a php include, would this be the problem?

Thanks in advanced for any help provided :)
6:12 pm on Feb 4, 2011 (gmt 0)

WebmasterWorld Senior Member rocknbil is a WebmasterWorld Top Contributor of All Time 10+ Year Member




The first thing that comes to mind is you've errantly left out https://

<a href="www.example.com">

That would do it too.

The only other thing I can think of ATM is that you have a base href interfering with the mix(?, though it shouldn't with fully qualified links.)

<base href=" [mainsite.com">...]

</head>
7:02 pm on Feb 4, 2011 (gmt 0)



I'm sorry to say that I was calling the wrong file from my test page, can't say I didn't learn from this though, I didn't know about the base tag before this conversation :)

Thanks rocknbil, it all working fine now.