Please take our Survey
logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

Re: root_url and http_host: msg#00000

cms.phpslash.devel

Subject: Re: root_url and http_host

On Thu, Dec 19, 2002 at 11:32:57AM -0600, Joe Stewart wrote:
>
> Mike Gifford and I have been discussing something that I've brought up
> before.
>
> Whether root_url should just be the relative path and not include the full
> url.
>
> In short to paraphrase Mike:
>
> "Would it just be easier to specify a host:
> $_PSL['http_host'] = $_ENV['HTTP_HOST'];
>
> & have the root url be somthing like this (if it's in a subdirectory of
> the site):
> $_PSL['rooturl'] = '/public_html';"
>

I played around with having config.php detect the basedir and rooturl
if it is not given in config.ini. This only left the db variables and
dir.include. I also played around with setting up variables for the
domain name and host name.

Worked OK except for the scripts in the admin directory. The rooturl
changed and screwed it all up. The rooturl has /admin appended. Then
adminurl appends /admin again. Anybody got any good ideas? I sure
don't.

Joe

// basedir -> complete filesystem path to the pages
if(empty($_PSL['basedir'])) {
$_PSL['basedir'] = getcwd();
}

...skip...

// rooturl -> The base URL for the PHPSlash site.
if(empty($_PSL['rooturl'])) {
$url = parse_url($_SERVER['REQUEST_URI']);
$pathinfo = pathinfo($url['path']);
$_PSL['rooturl'] = $pathinfo['dirname'];
}

// root.http_host -> The hostname of the PHPSlash site.
if(empty($_PSL['root.http_host'])) {
$_PSL['root.http_host'] = $_SERVER['HTTP_HOST'];
}

// root.domain -> The domain for the PHPSlash site.
if(empty($_PSL['root.domain'])) {
$server_parts = explode('.', $_PSL['root.http_host']);
$count = count($server_parts);
if($count > 1) {
$_PSL['root.domain.tld'] = $server_parts[$count-1];
$_PSL['root.domain.name'] = $server_parts[$count-2];
$_PSL['root.domain'] = $_PSL['root.domain.name'] .".".
$_PSL['root.domain.tld'];
unset($server_parts[$count-1]);
unset($server_parts[$count-2]);
$_PSL['root.domain.host'] = implode('.', $server_parts);
} else {
// no tld - like localhost
$_PSL['root.domain.tld'] = '';
$_PSL['root.domain.name'] = $_PSL['root.http_host'];
$_PSL['root.domain'] = $_PSL['root.http_host'];
$_PSL['root.domain.host'] = '';
}
}


> I always just do the rooturl as shown above. There a few templates that I
> either have to add the host or {SITE_HOST}. This is how phpslash.org and
> phpslash.sf.net generate correct links on one installation.
>
> Are there still any browser considerations? I believe NS4 will look up
> the url again for full urls and not relative.
>
> Any input?
>
> Joe
>


-------------------------------------------------------
This SF.net email is sponsored by: ValueWeb:
Dedicated Hosting for just $79/mo with 500 GB of bandwidth!
No other company gives more support or power for your dedicated server
http://click.atdmt.com/AFF/go/sdnxxaff00300020aff/direct/01/


<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
db.postgresql.b...    video.ffmpeg.us...    gis.qgis.devel/...    web.rdf.redland...    file-systems.oc...    recreation.rail...    systems.archos....    python.c++/2003...    lang.c--/2005-0...    multimedia.gpho...    network.unison....    editors.jedit.u...    hardware.pciids...    cms.tiki.cvs/20...    bug-tracking.ma...    java.hadoop.hba...    ietf.rsvp/2002-...    xfree86.devel/2...    qnx.openqnx.dev...    apache.labs.dev...    tex.pdftex/2008...    os.solaris.open...    user-groups.lin...    kde.koffice/200...   
Home | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation