Joomla! Discussion Forums



It is currently Wed Nov 25, 2009 5:44 am (All times are UTC )

 


Forum rules

Please submit all new Tips and Tricks to: http://docs.joomla.org/Category:Tips_and_tricks

This forum section will be closed and removed eventually.



Post new topic Reply to topic  [ 1 post ] 
Author Message
Posted: Fri Aug 03, 2007 1:36 pm 
Joomla! Apprentice
Joomla! Apprentice
Offline

Joined: Sun Apr 29, 2007 3:24 am
Posts: 34
It is also related to debugging between localhost or mysitedebugdomainname.com.

Q: Unable to view my site properly from my debug domain name: mysitedebugdomainname.com, only from localhost that it is displayed properly. Is there a way to make the transition automatic!

A: YES!

The 'problem' is related to the variable $mosConfig_live_site. When changing from localhost to mysitedomain.com we assume that your site is going live. Therefore, you want to update the $mosConfig_live_site variable in the configuration file.

If you need to perform other test with a temporary "almost" live site then you would have to change that variable every time.

Now, you could also modify your configuration file like this.

Change this line
Code:
$mosConfig_live_site = 'http://localhost/myvirtualdirectory';


to
Code:
$mosConfig_live_site = getLiveSite();  //'http://localhost/myvirtualdirectory';


At the bottom of the file and BEFORE the php closing bracket "?>", add the following function:
Code:
function getLiveSite(){
$s = empty($_SERVER["HTTPS"]) ? ''
      : ($_SERVER["HTTPS"] == "on") ? "s"
      : "";
   $proto = explode('/', $_SERVER["SERVER_PROTOCOL"]);
   $protocol = strtolower($proto[0]).$s;
   $port = ($_SERVER["SERVER_PORT"] == "80") ? ""
      : (":".$_SERVER["SERVER_PORT"]);

   $getVD = explode('/', $_SERVER['PHP_SELF']);
   if(count($getVD) <=2 ){
      $virtualdir = '';   
   }
   else{
      $virtualdir = '/' . $getVD[1];
   }
   

   return $protocol."://".$_SERVER['SERVER_NAME'].$port. $virtualdir;

}


Of course, PHP expert can modify this function to make it look even better.

-----------------

With Apache, if you have set you VirtualHost to "/virtualdirectory" in the httpd.conf file, it will also work.

_________________
Sebastien Dube
_____________________________________________

You want to offer professional web service(s) through paid subscription? Visit http://www.webservicesgateway.com


Top
   
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 1 post ] 

Quick reply

 



Who is online

Users browsing this forum: No registered users and 10 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group