What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Skype & Technology » Tech Talk » get URI folder for executing PHP script

get URI folder for executing PHP script
Author: Message:
WDZ
Former Admin
*****

Avatar

Posts: 7106
Reputation: 107
– / Male / Flag
Joined: Mar 2002
RE: get URI folder for executing PHP script
SCRIPT_URI? I've never seen that used in PHP... :-/ (Edit: Apparently it only exists under Apache with mod_rewrite enabled)

Anyway, the easiest way to remove the filename is to use the dirname() function... :p

code:
if(empty($_SERVER['REQUEST_URI'])) {
    $_SERVER['REQUEST_URI'] = $_SERVER['SCRIPT_NAME'];
}

// Strip off query string so dirname() doesn't get confused
$url = preg_replace('/\?.*$/', '', $_SERVER['REQUEST_URI']);
$url = 'http://'.$_SERVER['HTTP_HOST'].'/'.ltrim(dirname($url), '/').'/';
http://shoutbox.menthix.net/crap/asdf/uri_test.php :spam:

This post was edited on 08-29-2007 at 01:19 AM by WDZ.
08-29-2007 12:58 AM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
get URI folder for executing PHP script - by MeEtc on 08-28-2007 at 11:49 PM
RE: get URI folder for executing PHP script - by WDZ on 08-29-2007 at 12:27 AM
RE: get URI folder for executing PHP script - by MeEtc on 08-29-2007 at 12:37 AM
RE: get URI folder for executing PHP script - by roflmao456 on 08-29-2007 at 12:40 AM
RE: get URI folder for executing PHP script - by WDZ on 08-29-2007 at 12:58 AM
RE: get URI folder for executing PHP script - by MeEtc on 08-29-2007 at 02:41 AM
RE: get URI folder for executing PHP script - by roflmao456 on 08-29-2007 at 03:27 AM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On