$base_url works in sub-directory, not in domain root
Posted: Sun May 13, 2007 12:55 pm
How do I specify the domain root (the main public_html directory, not a sub-directory)?
Someone helped me with a PHP script. In part of the script, he wrote:
In $base_url I am supposed to enter the path after the domain root (the part after domain.com) where the site is installed. As long as it is installed in a sub-directory and I specify it, it works properly. e.g., if I install the site in domain.com/my_sub-directory/ then it works.
But, ultimately I want to put the site in the domain root, so the home page will be in the public_html directory, not a sub-directory. I don't know what to specify for $base_url in that case, because nothing I tried works.
For $base_url when in the domain root, I tried:
$base_url = '/';
$base_url = '';
$base_url = ' ';
$base_url = '~';
none of those worked.
What do I enter in $base_url when the site is installed at the domain root immediately in the public_html directory?
.
Someone helped me with a PHP script. In part of the script, he wrote:
Code: Select all
$base_url = '/my_sub-directory/';
$replace_me = str_replace($base_url, '', $_SERVER['PHP_SELF']);But, ultimately I want to put the site in the domain root, so the home page will be in the public_html directory, not a sub-directory. I don't know what to specify for $base_url in that case, because nothing I tried works.
Code: Select all
$base_url = '/';
$replace_me = str_replace($base_url, '', $_SERVER['PHP_SELF']);$base_url = '/';
$base_url = '';
$base_url = ' ';
$base_url = '~';
none of those worked.
What do I enter in $base_url when the site is installed at the domain root immediately in the public_html directory?
.