iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 04-06-2006, 05:34 PM
WebProWorld Veteran
 
Join Date: Jul 2003
Location: Spain
Posts: 343
computergenius RepRank 1
Default Base Href

I am having a lot of problems with base href. It is set in the header, before anything starts up, as <BASE href="http://www.mydomain.com/">

The main reason is for pages like
thispage.php?X=123 - I do a redirect to
X/123.htm
which now appears to be in a different folder (mydomain.com/X) - so I need that base href to call other pages, like
mydomain.com/Y.php - I can just put in a link to Y.php, and base href points the visitor to the root folder.

As far as I can see, this is bog standard. But I am getting loads of error messages, I would guess from robots, which are looking for mydomain.com/X/Y.php - they are ignoring the base href.

Does anyone else have this issue?

Pete
Reply With Quote
  #2 (permalink)  
Old 04-08-2006, 09:27 AM
WebProWorld Member
 
Join Date: Jul 2003
Location: Philadelphia
Posts: 82
dean RepRank 1
Default base href

They're not ignoring the base href, you need to go up one level. You could try the unix shorthand with the 2 periods. In http://mydomain.com/x your relative link to Y.php would be ../Y.php
In other words, your base href is appended to the current directory, X. A relative link in X would be appended to the base href + the current directory, thus http://mydomain.com/X/Y.php. If Y.php was inside X, everything would be fine, but if it is in mydomain.com along with X and others, you need to go up one level.
Reply With Quote
  #3 (permalink)  
Old 04-08-2006, 10:07 AM
WebProWorld Veteran
 
Join Date: Jul 2003
Location: Spain
Posts: 343
computergenius RepRank 1
Default Re: base href

Quote:
Originally Posted by dean
They're not ignoring the base href, you need to go up one level. You could try the unix shorthand with the 2 periods. In http://mydomain.com/x your relative link to Y.php would be ../Y.php
In other words, your base href is appended to the current directory, X. A relative link in X would be appended to the base href + the current directory, thus http://mydomain.com/X/Y.php. If Y.php was inside X, everything would be fine, but if it is in mydomain.com along with X and others, you need to go up one level.
I am not sure that I understand what you mean by "go up a level" - you mean that I should change my base ref to something else, or I should change my link which leads to Y.php?

I can't see what I would change base href to, and if I change the link to Y.php to be "../y.php" - then why am I using base href?? Needless to say, this is a simplification, there are other links, which need to be relative to current page.

So, I hesitate to disagree with you, when I can't get it working fully myself, but I don't believe that the base href is added to the current directory. I believe that the base href totally ignores the current directory.

I have changed the base href to be the 'real name' of the first file, so that it is now http://www.mydomain.com/thispage.php
- and I haven't had any errors in the last 24 hours! But could just be co-incidence.
Reply With Quote
  #4 (permalink)  
Old 04-08-2006, 11:12 AM
WebProWorld Member
 
Join Date: Jul 2003
Location: Philadelphia
Posts: 82
dean RepRank 1
Default

Yes, the base href does ignore the current directory. What indicated to me that you needed to go up one level is what you were actually getting:
mydomain.com/x/y.php
It all gets pretty confusing when we don't see the whole thing. It looked to me like you set the base href in the top page, then when you click to x, you are now at mydomain.com/x, so the current directory is appended to relative links within that page, unless you have also included the base href within x.php.
Anyway, I'm glad you got it working.
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT -4. The time now is 10:48 AM.



Search Engine Optimization by vBSEO 3.3.0