PDA

View Full Version : problem using base href tag


Fred
07-10-2006, 02:54 PM
I have been using the <base href tag in my Wordpress installation, and it works great for converting all relative img and insite page links into absolute links universally throughout the blog but it's also creating a problem.

I cannot add any links to other domains without it adding my own base URL to them, creating an invalid link. Is there an override tag I can use to disable the base href function for specific individual URLs?

I am asking about this here because a moderator in the Wordpress support forums recommended I "seek out a forum oriented more towards "pure" web/(x)html as opposed to WP for a more informed answer."

ronaldb66
07-10-2006, 03:55 PM
I must admit I rarely use the base element for controlling relative URLs, but if you specify your links to extenal domains as absolute ones there should be no problem.
If I do not understand your issue correctly, please provide additional information like:

What base URL are you specifying;
what your relative links look like;
what do the links that fail te resolve look like: how have you specified them, and what do they actually resolve to?

Fred
07-10-2006, 04:12 PM
Ronald,
I am using <base href="http://www.beyourowndetective.com/"/>, in the header.php file of wordpress. Relative image links are img src="images/***.jpg, gif etc.." internal page links within my site may be a href="index.html" or a href="pub/index.html."

Where the problem occurs is when I want to put in an embedded link to another site say for example codingforums.com, then I will end up with this appearing on my blog page:

"http://www.beyourowndetective.com/http://www.codingforums.com"

On static pages I have always simply used "images/***.jpg" or "../images/***.jpg" if it's one directory back, same with page links and this has always worked fine. I thought of using this in my wordpress blog, but I was concerned the Permalinks system might cause problems with it.

Thanks

Pepe, the bull
07-10-2006, 05:59 PM
It is my understanding that if you include http:// in your href that it will override the base tag.

I did some tests and it always worked for me in IE6 and FF.


<head>
<base href="http://www.codingforums.com/">
</head>
...
<a href="link.html">link</a> (takes you to http://www.codingforums.com/link.html)
<a href="http://www.google.com/link.html">Google link</a> (takes you to http://www.google.com/link.html)

Do you have a link the the page with the problem so we can look?

Fred
07-10-2006, 10:32 PM
I just discovered that it's doing a totally bizarre thing. See in http://www.beyourowndetective.com/blog, my blog post "Routine background checks," look for the "credit reports" link which should be linking to http://www.clean-credit.org, also below same paragraph the link "Net Detective," which should be linking to a subdirectory page /netdetective within my own site.

A link to my axs tracking "/cgi-bin/axs/ax.pl?" is somehow mysteriously being added to both my links within this post. I am using the AXS plugin, but I don't understand how it's getting into these links. When I take the Clean Credit link out, the problem goes away.

Fred

Fred
07-11-2006, 02:53 AM
I just discovered the problem, and fixed it. It was the AXS integration plugin I have been using with Wordpress. I needed to uncheck a checkbox "Automatically track offsite links (attempts to track offsite links in comments and posts)."