Forums / Installing on a Windows Server / Why does localhost opens my live website ?

Why does localhost opens my live website ?

Results 1 to 13 of 13
11 Feb 2016, 15:05
#1
cj_dekrijger avatar

cj_dekrijger

New Zenner

Join Date:
Jul 2015
Posts:
76
Plugin Contributions:
0

Why does localhost opens my live website ?

Hai,

On a certain moment my localhost environnement does not work anymore, my host file
only says "127.0.0.1 Localhost " but the URL "localhost"opens my live website ?
xampp Apache and SQL is running
Does some body have an idea how this is possible ?

regards, Cees
12 Feb 2016, 08:50
#2
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Posts:
2,850
Plugin Contributions:
3

Re: Why does localhost opens my live website ?

Your includes/configure.php still has references to the live site.

For local use, make a /includes/local/configure.php with the correct local parameters.

If you go nuts trying to make it work, install another copy of ZC locally and use the generated configure.php as a reference point for local use.
13 Feb 2016, 07:24
#3
cj_dekrijger avatar

cj_dekrijger

New Zenner

Join Date:
Jul 2015
Posts:
76
Plugin Contributions:
0

Re: Why does localhost opens my live website ?

torvista:

Your includes/configure.php still has references to the live site.

For local use, make a /includes/local/configure.php with the correct local parameters.


Hai, torvista, this is my configure.php, can you direct my to the fault ?


<?php
/**
* @package Configuration Settings circa 1.5.4
* @copyright Copyright 2003-2014 Zen Cart Development Team
* @copyright Portions Copyright 2003 osCommerce
* @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
* File Built by zc_install on 2015-07-12 09:45:00
*/


/*************** NOTE: This file is similar, but DIFFERENT from the "admin" version of configure.php. ***********/
/*************** The 2 files should be kept separate and not used to overwrite each other. ***********/

// Define the webserver and path parameters
// HTTP_SERVER is your Main webserver: eg-http://www.your_domain.com
// HTTPS_SERVER is your Secure webserver: eg-https://www.your_domain.com
define('HTTP_SERVER', 'http://localhost');
define('HTTPS_SERVER', 'https://localhost');

// Use secure webserver for checkout procedure?
define('ENABLE_SSL', 'false');

// NOTE: be sure to leave the trailing '/' at the end of these lines if you make changes!
// * DIR_WS_* = Webserver directories (virtual/URL)
// these paths are relative to top of your webspace ... (ie: under the public_html or httpdocs folder)
define('DIR_WS_CATALOG', '/');
define('DIR_WS_HTTPS_CATALOG', '/');

define('DIR_WS_IMAGES', 'images/');
define('DIR_WS_INCLUDES', 'includes/');
define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');
define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');
define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');
define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');
define('DIR_WS_DOWNLOAD_PUBLIC', DIR_WS_CATALOG . 'pub/');
define('DIR_WS_TEMPLATES', DIR_WS_INCLUDES . 'templates/');

define('DIR_WS_PHPBB', '/');

// * DIR_FS_* = Filesystem directories (local/physical)
//the following path is a COMPLETE path to your Zen Cart files. eg: /var/www/vhost/accountname/public_html/store/
define('DIR_FS_CATALOG', 'C:/xampp/htdocs/');

//the following path is a COMPLETE path to the /logs/ folder eg: /var/www/vhost/accountname/public_html/store/logs ... and no trailing slash
define('DIR_FS_LOGS', 'C:/xampp/htdocs/logs');

define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');
define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');
define('DIR_WS_UPLOADS', DIR_WS_IMAGES . 'uploads/');
define('DIR_FS_UPLOADS', DIR_FS_CATALOG . DIR_WS_UPLOADS);
define('DIR_FS_EMAIL_TEMPLATES', DIR_FS_CATALOG . 'email/');

// define our database connection
define('DB_TYPE', 'mysql');
define('DB_PREFIX', 'usedpc');
define('DB_CHARSET', 'utf8');
define('DB_SERVER', 'localhost');
define('DB_SERVER_USERNAME', 'root');
define('DB_SERVER_PASSWORD', 'xampp1951');
define('DB_DATABASE', 'usedpc');

// The next 2 "defines" are for SQL cache support.
// For SQL_CACHE_METHOD, you can select from: none, database, or file
// If you choose "file", then you need to set the DIR_FS_SQL_CACHE to a directory where your apache
// or webserver user has write privileges (chmod 666 or 777). We recommend using the "cache" folder inside the Zen Cart folder
// ie: /path/to/your/webspace/public_html/zen/cache -- leave no trailing slash
define('SQL_CACHE_METHOD', 'none');
define('DIR_FS_SQL_CACHE', 'C:/xampp/htdocs/cache');

// EOF
13 Feb 2016, 11:26
#4
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,907
Plugin Contributions:
1

Re: Why does localhost opens my live website ?

So the other question would be do you have any overrides in your includes/local directory that would define any of those constants before being loaded?
14 Feb 2016, 06:20
#5
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,506
Plugin Contributions:
173

Re: Why does localhost opens my live website ?

Also, you might have added a custom .htaccess file to your server (for rewriting for prettified URLs or whatever you've added that didn't come with Zen Cart), and copied it to your local, and your local is therefore processing all the rewrites and redirects in the .htaccess which is taking you back to your live site.
15 Feb 2016, 21:17
#6
cj_dekrijger avatar

cj_dekrijger

New Zenner

Join Date:
Jul 2015
Posts:
76
Plugin Contributions:
0

Re: Why does localhost opens my live website ?

hai,

I have taken out some files like .htaccess, robots.txt sitemap.xml, but that didn't solve the problem, i tried
localhost/phpmyadmin does opens my database at localhost !

Any other suggestions where to look ?

regards
15 Feb 2016, 21:45
#7
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,506
Plugin Contributions:
173

Re: Why does localhost opens my live website ?

Okay, now do a complete search of the contents of all your files, looking for your domain name. It shouldn't be in any of your local files.
17 Feb 2016, 08:08
#8
cj_dekrijger avatar

cj_dekrijger

New Zenner

Join Date:
Jul 2015
Posts:
76
Plugin Contributions:
0

Re: Why does localhost opens my live website ?

DrByte,

Perhaps i missunderstand you but a search on itparts.biz comes up with 65 files
17 Feb 2016, 11:23
#9
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,907
Plugin Contributions:
1

Re: Why does localhost opens my live website ?

cj.dekrijger:

DrByte,

Perhaps i missunderstand you but a search on itparts.biz comes up with 65 files


The way Zc is written is such that the only place the server name is to appear is in the configure.php files... All other references are relative to that. Custom modifications when made ought to be written the same way. It appears that in such customizations the link(s) added/modified have been hard coded. This can be resolved typically by comparing the affected file(s) to the default ZC template/core files. Alternatively, the template could be switched to the default green template and if proper coding has been done all references will remain relative to the localhost. By proper coding meaning that the default template files remain untouched and all (majority of) modifications are made in template files using the override system.
19 Feb 2016, 08:41
#10
cj_dekrijger avatar

cj_dekrijger

New Zenner

Join Date:
Jul 2015
Posts:
76
Plugin Contributions:
0

Re: Why does localhost opens my live website ?

hai,

I am not a php programmer and created itparts.biz without taken care off the override system,
it's all done on trial and error and help from pro's like yourself, so i am to far into itparts.biz to
go back to that override system. As you can see at itparts.biz it's an up and running website.
I realy don't understand the suggestion of drbyte, as the name itparts.biz is used all along the
website. So i am in need of a proper description where to look for to find the problem
"why i losed my localhost development environnement"
19 Feb 2016, 09:32
#11
torvista avatar

torvista

Totally Zenned

Join Date:
Aug 2007
Posts:
2,850
Plugin Contributions:
3

Re: Why does localhost opens my live website ?

To clarify what has been said.
Your website knows exactly where it is by what is defined in the configure.php files.
This is the ONLY place where the actual REAL name of the website www.whatever.com may be used in the entire ZC fileset.

NOWHERE else in the entire site should have the REAL address written in the code: it should use the constant that this address is assigned to: HTTP_SERVER or HTTPS_SERVER
and any reference to other files in the filesystem should use a combination of the CONSTANTS defined in configure.php to get there, never the actual paths.
If you don't do this, you get all the problems you are experiencing now where the site is not portable.

This is another example of why (I believe) one should develop locally, you would have found and solved this issue years ago when you first moved it online.
20 Feb 2016, 13:23
#12
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,907
Plugin Contributions:
1

Re: Why does localhost opens my live website ?

Tools to help you "find" the problem and then possibly post the area of code so that you can be provided some direct guidance on how to fix your issue unless you choose to invest in someone directly supporting the "repair".

In your admin, goto tools->Developers Toolkit.

Suggestion is to use the lower row, though there are other rows like the templates row that ought to provide desired results.

Anyways, if you use the lower row, then in the first block, type in the base of the site's url (exclude http:// or https:// portion), for now select in the dropdown catalog, then on the right side click the button. After some processing time, the results should appear at the top of the screen. Any file that is not includes/configure.php, in the includes/local/ directory, admin/includes/configure.php, or in the admin/includes/local/ directory is suspect to have been hard coded (using the url directly) rather than as torvista described using a portable method of coding. Portable meaning that it is easy to move/copy a site from one location to another and everything to still work after a small modification in "one" place (store side and then admin side).

more than likely the changes will all be in a folder related to your current (or past) template files. If not then that bridge can be crossed when it comes, but if they are not in the template folder for your specific template, the next upgrade may become a bit challenging...
28 Feb 2016, 13:55
#13
cj_dekrijger avatar

cj_dekrijger

New Zenner

Join Date:
Jul 2015
Posts:
76
Plugin Contributions:
0

Re: Why does localhost opens my live website ?

Hai @ torvista, mc12345678 and DrByte,

I have managed to get my localhost environnement working again, i took me an hour of 7
but it works!
I have taken a backup from 2 months ago and the database from the same date!
Checked that all the directory's are there with the right files in it, that does it.
After that here and there changed some files to get the same version as the live site,
Database from the live site copied , its all working again.
Perhaps that i come into little differences but oke !

Thanks for your time and suggestions,

regards, Cees