PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Well the way I handle this:
always use absolute urls, my main includes set up $BASE_URL and $SECURE_URL which includes the protocol, hostname, and baselevel directories needed by the pages. I also have a site configuration variable "SECURITY_LEVEL" which can be "None | Login | Always". When none both base and secure use http, when login, base is http and secure is https, when always both are https. This way if I'm on a demo machine without ssl, I can quickly turn off those features, but still keep all the links working, or if I'm on the production machine that has enough power to ssl all page views it goes to always. When I'm developing or on non-dedicated machines I use the login setting.
The tradeoff to me for always using the absolutes is that it break GET-fallback for cookies rejected as PHP won't propagate the sessionid to absolute urls (at least it used to no, I'm not sure if it does now, I remember a discussion about how it would if the domain was local....)
I'm sure there are plenty of other (possibly better) ways.