homepage Welcome to WebmasterWorld Guest from
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

Links inside php include

Msg#: 4262533 posted 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>

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 :)



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

Msg#: 4262533 posted 6:12 pm on Feb 4, 2011 (gmt 0)

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=" https://www.mainsite.com">



Msg#: 4262533 posted 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.

Global Options:
 top home search open messages active posts  

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved