|
|
||||||
|
||||||
| Index Link To US Private Messages Archive FAQ RSS | ||||||
| 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
|
||||
|
![]() |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
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 |
|
|||
|
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. |
|
|||
|
Quote:
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. |
|
|||
|
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. |
![]() |
|
| Thread Tools | |
| Display Modes | |
|
|
|
WebProWorld |
Advertise |
Contact Us |
About |
Forum Rules |
MVP's |
Archive |
Newsletter Archive |
Top |
WebProNews
WebProWorld is an iEntry, Inc. ® site - © 2009 All Rights Reserved Privacy Policy and Legal iEntry, Inc. 2549 Richmond Rd. Lexington KY, 40509 |