Results 1 to 10 of 21

Hybrid View

  1. #1
    Join Date
    Jun 2005
    Location
    Kelowna, BC Canada
    Posts
    1,075
    Plugin Contributions
    6

    Default Re: Is <base href tag necessary?

    In my readings, I found arguments that directly conflict your believe about extra resources. They say the opposite... that translating a relative URL with each and every call takes unnecessary cycles.

    I really don't know, so I'm not arguing. Just saying it isn't that clear cut. They also make a lot of points about it killing people in terms of SEO as one goof can have tragic consequences. Again, I don't know. Nor do I really care. Google seems to find me just fine with no particular SEO efforts.

    Anyway, I would like to hear from a devleoper on this because the base href code is in the default template and I'd like to know why. Again, removing it has not seemed to have any ill effect and it did resolve my anchor problem. An anchor problem I no longer have, mind you, since i've subsequently changed my mind on how I want to handle foot notes :)

    So I could uncomment the base href tag if there's any compelling reason to do so.

  2. #2
    Join Date
    Feb 2012
    Location
    mostly harmless
    Posts
    1,809
    Plugin Contributions
    8

    Default Re: Is <base href tag necessary?

    As already mentioned, adding the base element just ensures any HTML compliant parser ĺsuch as a web browser) knows what base URL should be prepended to any COMPLETLY relative links (stuff like "image.jpg" and "stylesheet.css"). For web pages if all links to external resources are absolute ("https://example.com/image.jpg", "http://example.com/image.jpg", "//example.com/image.jpg") or SITE relative ("/image.jpg") it is not needed. For emails if all external links are absolute it is not needed.

    For the following examples the URL requested by a browser (or other reader) is "http://example.com/folder/index.php" and the base element is not specified. A link to "image.jpg" should result in the browser requesting "http://example.com/folder/image.jpg". A link to "/image.jpg" should result in the browser requesting "http://example.com/image.jpg".

    Zen Cart out-of-box currently uses a mixture of COMPLETELY relative links and absolute links. Internally Zen Cart knows what the BASE path is to physical images and the website relative path used to access those resources. Those are the FS_* and WS_* defines respectively in the "configure.php" files. These are used when generating both COMPLETELY relative and absolute links.

    Can you guess what would happen in the future if a page was added at "http://example.com/folder/category/my-product-name-456.html"? Zen Cart will still generate COMPLETELY relative links as "image.jpg". The broswer will request "http://example.com/folder/category/image.jpg". But the image is physically at "/username/public_html/folder/image.jpg" not "/username/public_html/folder/category/image.jpg"; resulting in the web server returning a "HTTP 404 - Not Found".

    So including the base element helps ensure COMPLETELY relative links generated by Zen Cart are loaded from the correct location. If desired (to avoid having to specify the anchor with the page - such as "index.php?main_page=index#anchor"), one CAN remove the base href from the web page template without any major issues when NO URLs outside the installation root are used.
    Last edited by lhungil; 8 Nov 2015 at 09:36 AM.
    The glass is not half full. The glass is not half empty. The glass is simply too big!
    Where are the Zen Cart Debug Logs? Where are the HTTP 500 / Server Error Logs?
    Zen Cart related projects maintained by lhûngîl : Plugin / Module Tracker

  3. #3
    Join Date
    Jun 2005
    Location
    Kelowna, BC Canada
    Posts
    1,075
    Plugin Contributions
    6

    Default Re: Is <base href tag necessary?

    Quote Originally Posted by lhungil View Post
    Can you guess what would happen in the future if a page was added at "http://example.com/folder/category/my-product-name-456.html"?
    When would that come up though? Zen doesn't reference them like that, but rather: "http://example.com/folder/index.php?main_page=product_info&cPath=3&products_id=378"

    So... are we talking about SEO friendly hacked url's? Is that when I'd run into trouble?

  4. #4
    Join Date
    Jun 2005
    Location
    Kelowna, BC Canada
    Posts
    1,075
    Plugin Contributions
    6

    Default Re: Is <base href tag necessary?

    Quote Originally Posted by lhungil View Post
    If desired (to avoid having to specify the anchor with the page - such as "index.php?main_page=index#anchor"), one CAN remove the base href from the web page template without any major issues when NO URLs outside the installation root are used.
    So that would have been my other solution then, right? To specify the anchor links as you showed? I didn't know that. That would have been fine too and I'll keep that in mind, if I'm understanding you correctly.

  5. #5
    Join Date
    Feb 2012
    Location
    mostly harmless
    Posts
    1,809
    Plugin Contributions
    8

    Default Re: Is <base href tag necessary?

    Virtual URLs (aka "alternate", "pretty", "friendly", "short", etc) are one common case. Not all Virtual URLs are for "SEO friendly" purposes, some are to comply with requirements or overcome restrictions in external software. Some third party modules adding a "page" in a subdolder are another case. Basically any scenario where the URL could contain a "sub-directory".


    I suspect the base element is there as a "safety" feature because some of the Zen Cart code and some 3rd party modifications generate COMPLETELY relative URLs. In my experience the core development team strive to ensure Zen Cart will work for ALL users in as many scenarios as possible, thus the base element is added by the default template.


    If leaving the base element... When the anchor link is stored in the DB, specifying as ahown in the previous post will work (there are some other programmatic solutions as well). If in a PHP file, would recommend using the Zen Cart function to generate the URL and add the anchor afterwards (provides best long term compatibility).


    NOTE: I am not one of the core developers and am not speaking on their behalf. I am providing an answer based on my experience.The other people who have responded are also very knowledgable and should not be dismissed (and many of them are experienced Zen Cart consultants and / or developers).
    The glass is not half full. The glass is not half empty. The glass is simply too big!
    Where are the Zen Cart Debug Logs? Where are the HTTP 500 / Server Error Logs?
    Zen Cart related projects maintained by lhûngîl : Plugin / Module Tracker

  6. #6
    Join Date
    Jun 2005
    Location
    Kelowna, BC Canada
    Posts
    1,075
    Plugin Contributions
    6

    Default Re: Is <base href tag necessary?

    I have a better understanding now. Thank you very much.

  7. #7
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: Is <base href tag necessary?

    Quote Originally Posted by s_mack View Post
    In my readings, I found arguments that directly conflict your believe about extra resources.
    I didn't state any *belief*. I stated a well known *fact*, namely, Absolute URL's require the browsers make an additional DNS lookup for each request, and therefore they are much less efficient to use than the rels.

    Quote Originally Posted by s_mack View Post
    They say the opposite... that translating a relative URL with each and every call takes unnecessary cycles.
    Are you getting your info from Wikipedia?

    Yes, there will be/are few cycles of additional code that determines whether another DNS lookup is needed or not, but these few cycles are going to magnitudes less that the cycles needed to perform the lookups each and every time, needed or not.

    Do these 'arguments' also claim that the cycles and processing needed to determine whether an item can be fetched from a cache is somehow more 'costly' than using the cache in the first place? I would hope not, yet, this is almost exactly the same situation.

    Oh, and the cycles of which they are referring, are not unnecessary at all. I don't know where that came from.

    Quote Originally Posted by s_mack View Post
    I really don't know, so I'm not arguing.
    Fair enough, I can appreciate that you wouldn't want to argue about something you don't know, but TBH, I thought you'd have a better understanding of how DNS and caching worked, and you wouldn't fall into the trap of thinking a few extra cycles of code being used to bypass 100's of *possible* cycles would actually have a overall reduction in efficiency.

    Quote Originally Posted by s_mack View Post
    Just saying it isn't that clear cut.
    And I'm saying it IS clear cut. It is almost *common sense* if you sit back and think about exactly what we are discussing here.

    Quote Originally Posted by s_mack View Post
    They also make a lot of points about it killing people in terms of SEO as one goof can have tragic consequences.
    Now this is one of the most ridiculous things I've read in a long time. I'm not even going to try to explain on how many levels this is so wrong.

    Quote Originally Posted by s_mack View Post
    Again, I don't know. Nor do I really care.
    Do you realise that you are coming across as a troll? If you really don't know, and didn't care, then why take my words and throw them back at me with comments that some nameless people disagree with me?

    People disagree with me all the time, but that doesn't mean I'm wrong.

    The reason I'm even replying to your troll bait is because somewhere deep down in side I think you really are unsure about this, and being an educator, I'm happy to educate - as far as possible -

    I'm also responding for the benefit of others that once had a very good understanding that a few cycles spent in one place to save a few hundred cycles in another place has a net gain.

    Quote Originally Posted by s_mack View Post
    They say the opposite... that translating a relative URL with each and every call takes unnecessary cycles.
    Couldn't be more wrong if they tried.

    Quote Originally Posted by s_mack View Post
    Google seems to find me just fine with no particular SEO efforts.
    In relation to absolute vs Relative URL's, Google (and all other SE's) really do not, (in fact cannot) make a rating distinction between between the two. All pages and sites are indexed and ranked using absolute URL's - The search result would be useless otherwise.
    Think about it!

    This is actually far more true now than it was 10-20 years ago - Here's why - Back in times gone by, the crawling and indexing of a site were performed simultaneously in a single pass of the bot. As such, the ranking algorithms *were* able to determine the difference between an absolute and relative link as both are/were possible in the same page and on the same pass. There was the *opportunity* to adjust the rankings accordingly. I don't know any that did though.

    These days, almost all SE's use a two stage process - Stage one - is the crawling of the site, and stage two, determining the ranking. This ranking determination is based on the URL's and data stored on the SE servers, and the URL's stored there *must* be absolute - even if they were relative on the site itself. Again, think about it... If the SE's stored the relative URL's the search results would end up providing links back to Google itself, rather than the site where they were found.

    Quote Originally Posted by s_mack View Post
    Anyway, I would like to hear from a devleoper on this.
    I'm a developer, I've given my input. Look what you've done with it though.

    Quote Originally Posted by s_mack View Post
    because the base href code is in the default template and I'd like to know why.
    I've even answered this for you. You probably didn't realise it though because you've been too busy trying to dispute or find argument with almost anything and everything I've ever written.

    I really don't know why I bother sometimes, other than it is one of the many things I've been trained for. ;-)

    Cheers
    RodG

  8. #8
    Join Date
    Jun 2005
    Location
    Kelowna, BC Canada
    Posts
    1,075
    Plugin Contributions
    6

    Default Re: Is <base href tag necessary?

    Holy crap, calm the #$@# down man.

    Who's the troll? Wow. Some insecurities going on there, or what?


    Apparently YOU think it is MY job to take your word as gospel. You said one thing, I read another... that's all I was saying. There are sources after sources after sources suggesting your points are debatable, at the very least. But I'm supposed to just presume the guy in the shower cap knows everything.

    Do you know more about DNS than I do? I'm gonna say probably. Do you know more than I do about SEO? I'm not sure, but you probably care more than I do. But I'll tell you one thing I know more than you: the purpose of a discussion forum. We're not here for the "educator" to espouse his lessons onto use like children. We're here to discuss. That's what it was. I was *NOT* in any way whatsoever trying to "troll" you, that's 100% on your own insecurities. Brought out, I believe, not by my comments at all but by how I may have valued lhungil's assistance to a greater degree than yours.


    I'm a developer
    So am I... so's the kid next door. OBVIOUSLY I meant a developer of zencart. Your response seemed... uninformed... to the fact the code in question was part of the core distribution. I wanted to hear from them if there was a missing bit of info as to whether or not it had to be there.

    Bottom line. CHILLLLL. If you REALLY think that I'm a "troll" then walk away. If your pride got a little hurt, then say so and I could say I'm sorry (cause I really didn't meant anything). If its all just a misunderstanding... well, duck off a water's back (err)

  9. #9
    Join Date
    Jan 2007
    Location
    Australia
    Posts
    6,167
    Plugin Contributions
    7

    Default Re: Is <base href tag necessary?

    Quote Originally Posted by s_mack View Post
    Some insecurities going on there, or what?
    Quite the opposite. If anything I'm over confident. To the point where most people confuse it with arrogance.

    Not my problem.

    Quote Originally Posted by s_mack View Post
    Do you know more about DNS than I do?
    I would hope so. Although I closed the service down many years ago (over a decade), I used to run a public freeDNS service (wrote the software myself).

    Don't take my word for it though.. search Google for 'vcsweb freedns' - There's still quite a few pages and sites that refer to this long gone service.

    Quote Originally Posted by s_mack View Post
    Do you know more than I do about SEO? I'm not sure,
    Probably not, but I do know that regardless of a lot of the crap in those references you gave, none of them offer any 'proof' of the claims or statements - And the comments I previously made about the Google stored links all being absolute stands as solid as concrete.

    Quote Originally Posted by s_mack View Post
    but you probably care more than I do.
    What I care about are facts. I can't prevent some new aged people trying to convince the world that 2+2=5. What I can do is stand up to them and say '################'.

    It is then for other people to determine for themselves who is the biggest ################ter.

    Quote Originally Posted by s_mack View Post
    But I'll tell you one thing I know more than you: the purpose of a discussion forum. We're not here for the "educator" to espouse his lessons onto use like children.
    Don't care. I've dealt with lots of kids, teenages and adults that come can't make up their minds when confronted with opposing information.

    I probably used to be the same way when I was younger - never 100% sure about anything and always prepared to give the benefit of any doubts.

    These days I'm an old man, Not interested in making friends, and finally realise that life is far to short to try to please everyone, so I don't try. If I see or read BS, and I'll call it as such.

    If someone asks a question and I have the answer, I'll answer it. (depending on my available time and interest)

    It isn't your job to tell me where and when I should share my knowledge.

    Quote Originally Posted by s_mack View Post
    I may have valued lhungil's assistance to a greater degree than yours.
    And rightly so. lhungil's response was right on the money and covered the base ref scenario in far more detail than I did.

    Although more detailed, and summed into a single response, lhungil hasn't contradicted anything I've said or written, and I've not said or written anything to contradict his/her response.

    hungil hasn't expressed an opinion about the topic of efficiency, and very cleverly sidestepped the issue of SEO related issues.

    Quote Originally Posted by s_mack View Post
    So am I.(a developer).. so's the kid next door. .
    The kid next door probably hasn't been coding for 30+ years.

    I've no idea of your history, but I doubt you have either - If I were to take a punt, I'd say you were a 10-15yearer (developer, not age).

    You are going to be making mistakes and errors that I've learned to avoid before you even started.

    Quote Originally Posted by s_mack View Post
    OBVIOUSLY I meant a developer of zencart..
    Actually, there was nothing obvious about this. ZenCart didn't invent the base href so why would only a zencart developer know what it is for or when/why it is used?

    Quote Originally Posted by s_mack View Post
    Your response seemed... uninformed...
    My what a short memory you seem to have. Let me refresh that for you :-)

    ----------------------------------------------------------------------------------------
    However for the sake of discussion lets assume that the HTML in question is something to be sent as email - Eg, an order confirmation.

    If all of the links in the email are absolute, there is no problem.

    If some of the links are relative, and there isn't a base href tag then the email links can't/won't work, because the client software doesn't know what these links are relative *to*.

    In other words, in HTML formatted emails, if relative links are used, then the Base Href must also be used.

    When it comes to webpages on a website, then the relative links on the page are relative to the site they are on, No base href needed (except in very specific circumstances), and as a general rule it is best to NOT use them (at least in my personal opinion).

    So, quick summary...
    HTML formatted Emails. Use relative links *and* base Href, *or* absolute links and no base href needed.
    HTML Webpages - No base href needed.
    ----------------------------------------------------------------------------------------------------------------------------------

    This doesn't seem particularly uninformed to me. Can we have a show of hands from those that that agree with you that it is?

    Heck, even Kobra, ZenCart Black belt apparently thought that this was informed enough to warrant the question as to whether you actually read it or not'

    Quote Originally Posted by s_mack View Post
    to the fact the code in question was part of the core distribution. I wanted to hear from them if there was a missing bit of info as to whether or not it had to be there.
    I'm going to go out on a limb here, and suggest that the reason why none of the team have given an answer to this is either because they don't know, or the reason has been long forgotten. There could be several reasons why they wouldn't know (I've already detailed a couple in a previous reply), but IMO (note how I'm now stating opinion rather than fact) they don't know because they didn't write the code - It is/was carried over from when ZenCart was spit away from its parent code, OsCommerce.

    Oh, my. How rude of me - insinuating that the ZenCart Dev team don't even know their own code. We DO I get off with my grandstanding?
    Quote Originally Posted by s_mack View Post
    Bottom line. CHILLLLL. If you REALLY think that I'm a "troll" then walk away.
    Didn't say you were a troll, just that you were coming across as one. A huge difference.

    Quote Originally Posted by s_mack View Post
    If your pride got a little hurt,
    LOL, you *really* don't know me at all. I have no pride. I'm a 60y/o pensioner that goes to the supermarket in a dressing gown and slippers. I ######## when I fart.

    I am proud of many of my achievements over the years, but I have no personal pride as such.

    Quote Originally Posted by s_mack View Post
    then say so and I could say I'm sorry (cause I really didn't meant anything). If its all just a misunderstanding... well, duck off a water's back (err)
    Seriously, no pride or feelings hurt. Nothing for you to apologise for. Just somewhat frustrated at being 'challenged' by someone that I thought was wise enough to know better on several different levels, not the least being 'don't poke the dog'. :-)

    Cheers
    RodG

 

 

Similar Threads

  1. base href problem
    By cricles in forum Upgrading from 1.3.x to 1.3.9
    Replies: 3
    Last Post: 20 Jul 2010, 06:34 AM
  2. SSL Problem (Base href???)
    By DaveS in forum General Questions
    Replies: 24
    Last Post: 4 Sep 2009, 06:23 PM
  3. Base HREF https issues
    By mikebackhouse in forum General Questions
    Replies: 38
    Last Post: 27 May 2009, 05:12 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg