"Hard work surpasses genius"
by: Mark-
Web 2.0 platform and Programming Language
We are promoting Web 2.0 platform in our template design, xHTML in our scripting and PHP programming language in our server side programming. So try our services and be satisfied with the outcome.
-
HTML/xHTML Standard
This site passed and uses the W3C XHTML 1.0 Transitional standard, CSS level 2.1 driven, Javascript and with a latest trend of Table-less xHTML scripting by not using <table> tag in making our script.
-
Website History
This website was founded last October 18, 2007, fully bought the domain February 2008 and has been continually updating. We are located at heart of The City of Golden Friendship Cagayan de Oro the City.
PHP get root URL and root Directory path
This is a PHP code that gets the root or base path your website. By getting the protocol, the domain name and its directory location, if combine together will produce the root URL of your website. By removing also index.php on array variable $_SERVER['SCRIPT_FILENAME'] will produce the root directory path of your website.
This code is dynamic that even if you will change your website directory location it will still knows its location. You don’t have to change any configuration just to get the URL and Directory location of your file or website.
<?php
function root_url(){
$domain = $_SERVER['HTTP_HOST'];
$protocol_array = explode('/',$_SERVER['SERVER_PROTOCOL']);
$protocol = strtolower($protocol_array[0]);
$path = str_replace( basename($_SERVER['SCRIPT_FILENAME']), '', $_SERVER['PHP_SELF'] );
$url = $protocol.'://'.$domain.$path;
return $url;
}
function root_dir(){
$dir = dirname($_SERVER['SCRIPT_FILENAME']).'/';
return $dir;
}
?>
9 Responses to PHP get root URL and root Directory path
Leave a Reply
Services we offer
My Blogs
-
Configuring CodeIgniter for website with HTTPS protocol view more...
Posted: Jan 05, 12 at 11:27 am -
Keyword “Cagayan de Oro PHP Programmer” iWebProvider.com is Number 1 at Google Search view more...
Posted: Feb 15, 11 at 05:54 pm -
PHP get root URL and root Directory path view more...
Posted: Feb 15, 11 at 02:47 am -
PHP Object Oriented Programming (OOP) using Model View Controller (MVC) approach view more...
Posted: Feb 12, 11 at 01:56 pm -
Launching of the new 2011 iWebProvider.com Template Design view more...
Posted: Feb 03, 11 at 08:17 pm
Most Popular Blogs
-
Search Engine Friendly URL to convert .php and replace with .html file extension using .htaccess view more...
Posted: Jan 19, 11 at 09:44 am -
PHP Class for sending Email and preventing Email Spam view more...
Posted: Jan 19, 11 at 09:41 am -
PHP Function to Limit String output or display view more...
Posted: Jan 19, 11 at 09:39 am -
PHP get root URL and root Directory path view more...
Posted: Feb 15, 11 at 02:47 am
Wise Words
"It’s not about how many you have learned but how much you have utilized and mastered what you have learned."
by: Mark"The function of good software is to make the complex appear to be simple."
by: Grady BoochLatest Comments
My opinion is ...... Lovely just what I was searching for....
by: how to make homebrew...... this web site is my inspiration , very superb style and perfect content ....
by: cure panic attacksanother title... I saw this really great post today....
by: print to faxKeep in Touch
If you would like to find out more about us, just email us at inquiry[AT]iwebprovider.com

Blogs ou should be reading…
[...]Here is a Great Blog You Might Find Interesting that we Encourage You[...]……
guldmynt tillverkare…
[...]j I am really enjoying the theme/design of your web site. Do you ever run int dh[...]…
This is my Excerpt…
I saw this really good post today. Nice visiting your blog….
billigt flyg berlin…
[...]u Woah! I’m really loving the template/theme of this blog. It’s simple, yet e pw[...]…
free website submisson…
I found this really informative post today…
2011…
Having read this I thought it was very informative. I appreciate you taking the time and effort to put this article together. I once again find myself spending way to much time both reading and commenting. But so what, it was still worth it!…
Links…
[...]Sites of interest we have a link to[...]……
Related……
[...]just beneath, are numerous totally not related sites to ours, however, they are surely worth going over[...]……
Superb website…
[...]always a big fan of linking to bloggers that I love but don’t get a lot of link love from[...]……