Dealing with absolute paths while on localhost I have a long-term path problem while developing modules.

For instance I have the following project path http://localhost:8888/mylocalproject, which (on the production server) would be http://www.project.com.

Now each time I use global $base_url or other absolute paths it only returns me the http://localhost:8888/ not http://localhost:8888/mylocalproject. For instance if I want to handcraft a logout link will give me http://localhost:8888/user/logout which is wrong, since mylocalproject is excluded.

I have all the time to hack solutions like this

global $base_url;
$needle = "localhost";
if (strpos($_SERVER['REQUEST_URI'], $needle)) {
  path = $base_url."/mylocalproject";
}
else {
  path = $base_url;
}


Is there a Drupal standard solution for that?
You should just set the $base_url in your settings file while you're working on localhost, then you can just change it when you put the site live.

The settings file is at "sites/default/settings.php" and you should add:

$base_url = 'http://localhost:8888/mylocalproject';


Obviously when the site goes live you want to change/remove that line to match your new environment.