0

I downloaded my new project using FTP from my local. But when I check the codes if it is working in my local. All the directories are not pointing to my Project root path.

In my downloaded file I have this path in the config.php

/okushon/home/pages/js/jquery.animate-colors-min.js

When I checked in the browser it doesn't go to the file

But when I change the path to:

./okushon/home/pages/js/jquery.animate-colors-min.js

It goes to the file.

I don't know why in the live server it works but in my local the path doesn't work.

Jerielle
  • 7,144
  • 29
  • 98
  • 164

1 Answers1

0

To include javascript files with an absolute path you should use something like

http://www.your-domain.de/js/jquery.animate-colors-min.js

To use it on your local web server, replace it by something like

http://localhost/your-project/js/jquery.animate-colors-min.js

The best way is to use a path variable in an extra file which is included in every page:

if((isset($_SERVER["HTTP_HOST"]) && 'blablabla'==$_SERVER["HTTP_HOST"])){
    $incPath = '/path/to/your/files/';
    $httpPath = 'http://www.your-domain.de/';
}
else {
    $incPath = '/local/path/to/your/files/';
    $httpPath = 'http://localhost/your-project/';
}
Mel_T
  • 451
  • 5
  • 15