Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 21
  1. #11
    Join Date
    Jul 2012
    Posts
    16,740
    Plugin Contributions
    17

    Default Re: Is <base href tag necessary?

    Quote Originally Posted by s_mack View Post
    anchors. Attempting to use a relative link to a named anchor would take me back to the main index page rather than stay at the one I'm on. I couldn't figure out why then I found a lot of posts stating that named anchors are not really compatible with base href.

    Advice by some (in fact many) is to never use relative urls. Always absolute. I don't quite buy that, as it makes moving a site a nightmare. Others said to just ditch base href and all is good. Unless I'm missing something, that seems to be the case.
    Well, not sure if I fully invoked anchors or a variation on them, but one of the plugins I pushed Checkbox TextBox Icon Product Checkout, used a variation of the anchor process I thought in order to return back to the same location on the page after making a selection up or down and the page reloading... I don't recall if I had to make the same edit or if I came up with an other functional method. I may have "cheated" and only had the base href not show on specific pages... Not sure...
    ZC Installation/Maintenance Support <- Site
    Contribution for contributions welcome...

  2. #12
    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
    Advice by some (in fact many) is to never use relative urls. Always absolute. I don't quite buy that,
    I don't buy into that one either. Where possible I always use relative URL's.

    Quote Originally Posted by s_mack View Post
    as it makes moving a site a nightmare.
    Exactly.

    There is also the added argument (quite valid) that 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. This was more of a concern in days gone by, but I'm one of those that subscribe to the principle that just because CPU power and memory resources are almost limitless these days, it is no excuse for sloppy inefficient programming.

    Heck, I still use bit patterns and masking in a lot of my code for variable 'flags' (why use 8 bytes of data for 8 different variables when the same info can by handled in a single byte?). Clearly there is no *compelling* reason to skimp in this manner to save "thismuch" memory, but I do like my code to be as efficient as possible. :-)

    I wonder how much memory (and bandwidth) I/we can save (across the entire globe) if no one used absolute URL's except where necessary?
    Quote Originally Posted by s_mack View Post
    Others said to just ditch base href and all is good. Unless I'm missing something, that seems to be the case.
    I don't think I'd quite go THAT far either. I can't say I've ever created a site/page and intentionally added the base href (never found the need), but at the same time, if/when I come across it in existing (and fully functional code) I wouldn't just dive in and remove it either.

    It *may* have been added by some automated process (WYSIWYG HTML Creation tool) , or someone copying and pasting from elsewhere, where it serves no useful purpose, but it may also have been added with good reason by a developer for a specific use case that I/we are unaware of, and as such the removal may bite in unexpected ways.

    At the end of the day, as long as everything works as expected and intended, then by definition, it is the 'right' way. If it doesn't, then it is the wrong way. :-)

    Cheers
    RodG

  3. #13
    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.

  4. #14
    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

  5. #15
    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?

  6. #16
    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.

  7. #17
    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

  8. #18
    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.

  9. #19
    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

  10. #20
    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)

 

 
Page 2 of 3 FirstFirst 123 LastLast

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

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR