Way to define a variable to hold either a local URL or a hosted URL for a given web site page?
Permalink
I am creating my first C5 site locally on locahost before I upload to my web host and make the site and/or changes to the site live.
Now normally I use relative URL's and there is no problem. I can test such URL's just fine either locally or at my site without changing them.
But occasionally I must use an absolute URL that includes the domain name in the URL.
So on localhost my localized URL ishttp://somesite.com.c5 while at my host it ishttp://www.somesite.com (note the absence of the "www" and the "c5" in my local domain name).
On pages where I must use such an absolute URL it would be real nice to be able to somehow set whichever URL version I am using (depending on whether I am on localhost or at my web host) in a configuration file or a variable or something such that I would not have to remember to change the URL's every time I upload said page to the web host.
Is there something I can do through C5 in this regard?
Thanks.
Carlos
Now normally I use relative URL's and there is no problem. I can test such URL's just fine either locally or at my site without changing them.
But occasionally I must use an absolute URL that includes the domain name in the URL.
So on localhost my localized URL ishttp://somesite.com.c5 while at my host it ishttp://www.somesite.com (note the absence of the "www" and the "c5" in my local domain name).
On pages where I must use such an absolute URL it would be real nice to be able to somehow set whichever URL version I am using (depending on whether I am on localhost or at my web host) in a configuration file or a variable or something such that I would not have to remember to change the URL's every time I upload said page to the web host.
Is there something I can do through C5 in this regard?
Thanks.
Carlos
The BASE_URL setting in config/site.php is for this purpose.
Hmm...interesting. I'll have to play with that.
Today I am going to try and see if I can insert PHP into my pages somehow so that PHP code is run before C5 (or during) constructs the page and serves it up.
Thanks for getting back to me JordanLev.
Carlos
Today I am going to try and see if I can insert PHP into my pages somehow so that PHP code is run before C5 (or during) constructs the page and serves it up.
Thanks for getting back to me JordanLev.
Carlos