Git (Different paths Problem)

Hi everyone :lol:

I have some problem with GIT.

To make it simple. I have:

  • 1x website

  • 1x Git repo

  • 1x Local machine

Now Let say the name of the project is "[color="#0000FF"]NameProject[/color]"

On the website the basic url is [color="#0000FF"]nameproject.com[/color]

That the links like "css" folder: [color="#0000FF"]nameproject.com/css[/color]

BUT, on my local machine, it’s of course: [color="#0000FF"]localhost/NameProject[/color]

We developed the website for some times now without GIT, just FTP sync.

Now that we try to implement Git… we figured that all the internal paths are of course wrong.

We get the base path like that:




$http = 'http';                                                  

if($_SERVER["HTTPS"] == "on"){$http .= "s";}                                           

$curl = $http."://".$_SERVER["SERVER_NAME"]; 


...


$clientScript->registerCssFile($curl.'/css/screen.css'); 



If I do an


echo $curl;

we get

webserver: [color="#0000FF"]http://nameproject.com[/color]

localhost: [color="#0000FF"]http://localhost[/color]

BUT the problem is… the project is in [color="#0000FF"]http://localhost/NameProject[/color]

How do I redirect all the internal links to make is work Locally AND Remotely??

Thank you for your time :lol:


$clientScript->registerCssFile(Yii::app()->request->getBaseUrl(true) . '/css/screen.css');

[url="http://www.yiiframework.com/doc/api/1.1/CHttpRequest#getBaseUrl-detail"]

CHttpRequest::getBaseUrl()[/url]