Page 1 of 1

Moved site is redirecting and erroring out on backend

Posted: Sat Mar 07, 2020 11:59 pm
by brian47374
I am running OC 3.0.3.2 and I moved a site that I had created under one domain (a testing domain) to another where I intend on using it. I made changes to the config and admin/config files, but it keeps directing me to the old domain name when I type in the new URL. Btw… I am on the same DNS server, just under a different account.

In addition, when trying to access the admin login I am getting this message.

Code: Select all

Warning: fopen(/domain/storage/logs/openbay.log): failed to open stream: No such file or directory in /home/ domain /public_html/system/library/log.php on line 22Warning: fopen(/domain/storage/logs/error.log): failed to open stream: No such file or directory in /home/domain/public_html/system/library/log.php on line 22
Now, I checked in the d domain/storage/logs/openbay.log and there’s nothing in the log.
Then, I went to check domain /public_html/system/library/log.php and it is this…

Code: Select all

<?php
/**
 * @package		OpenCart
 * @author		Daniel Kerr
 * @copyright	Copyright (c) 2005 - 2017, OpenCart, Ltd. (https://www.opencart.com/)
 * @license		https://opensource.org/licenses/GPL-3.0
 * @link		https://www.opencart.com
*/

/**
* Log class
*/
class Log {
	private $handle;
	
	/**
	 * Constructor
	 *
	 * @param	string	$filename
 	*/
	public function __construct($filename) {
		$this->handle = fopen(DIR_LOGS . $filename, 'a');
	}
	
	/**
     * 
     *
     * @param	string	$message
     */
	public function write($message) {
		fwrite($this->handle, date('Y-m-d G:i:s') . ' - ' . print_r($message, true) . "\n");
	}
	
	/**
     * 
     *
     */
	public function __destruct() {
		fclose($this->handle);
	}
}

This is the config.php file
<?php

Code: Select all

// HTTP
define('HTTP_SERVER', 'http://newdomain.com/');

// HTTPS
define('HTTPS_SERVER', 'https://newdomain.com/');

// DIR
define('DIR_APPLICATION', '/home/newdomain/public_html/catalog/');
define('DIR_SYSTEM', '/home/newdomain/public_html/system/');
define('DIR_IMAGE', '/home/newdomain/public_html/image/');
define('DIR_STORAGE', '/home/newdomain/storage/');
define('DIR_LANGUAGE', DIR_APPLICATION . 'language/');
define('DIR_TEMPLATE', DIR_APPLICATION . 'view/theme/');
define('DIR_CONFIG', DIR_SYSTEM . 'config/');
define('DIR_CACHE', DIR_STORAGE . 'cache/');
define('DIR_DOWNLOAD', DIR_STORAGE . 'download/');
define('DIR_LOGS', DIR_STORAGE . 'logs/');
define('DIR_MODIFICATION', DIR_STORAGE . 'modification/');
define('DIR_SESSION', DIR_STORAGE . 'session/');
define('DIR_UPLOAD', DIR_STORAGE . 'upload/');

// DB
define('DB_DRIVER', 'mysqli');
define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', 'username');
define('DB_PASSWORD', 'password');
define('DB_DATABASE', 'dbname');
define('DB_PORT', '3306');
define('DB_PREFIX', 'oc_');
admin/config.php file

Code: Select all

<?php
// HTTP
define('HTTP_SERVER', 'https://newdomain/admin/');
define('HTTP_CATALOG', 'https://newdomain.com/');

// HTTPS
define('HTTPS_SERVER', 'https://newdomain.com/admin/');
define('HTTPS_CATALOG', 'https://newdomain.com/');

// DIR
define('DIR_APPLICATION', '/home/newdomain/public_html/admin/');
define('DIR_SYSTEM', '/home/newdomain/public_html/system/');
define('DIR_IMAGE', '/home/newdomain/public_html/image/');
define('DIR_STORAGE', '/newdomain/storage/');
define('DIR_CATALOG', '/home/newdomain/public_html/catalog/');
define('DIR_LANGUAGE', DIR_APPLICATION . 'language/');
define('DIR_TEMPLATE', DIR_APPLICATION . 'view/template/');
define('DIR_CONFIG', DIR_SYSTEM . 'config/');
define('DIR_CACHE', DIR_STORAGE . 'cache/');
define('DIR_DOWNLOAD', DIR_STORAGE . 'download/');
define('DIR_LOGS', DIR_STORAGE . 'logs/');
define('DIR_MODIFICATION', DIR_STORAGE . 'modification/');
define('DIR_SESSION', DIR_STORAGE . 'session/');
define('DIR_UPLOAD', DIR_STORAGE . 'upload/');

// DB
define('DB_DRIVER', 'mysqli');
define('DB_HOSTNAME', 'localhost');
define('DB_USERNAME', 'username');
define('DB_PASSWORD', 'password');
define('DB_DATABASE', 'dbname');
define('DB_PORT', '3306');
define('DB_PREFIX', 'oc_');

// OpenCart API
define('OPENCART_SERVER', 'https://www.opencart.com/');

Re: Moved site is redirecting and erroring out on backend

Posted: Sun Mar 08, 2020 12:48 am
by straightlight
Warning: fopen(/domain/storage/logs/openbay.log): failed to open stream: No such file or directory in /home/ domain /public_html/system/library/log.php on line 22Warning: fopen(/domain/storage/logs/error.log): failed to open stream: No such file or directory in /home/domain/public_html/system/library/log.php on line 22
Either the storage path does not exist outside of your public_html folder since the move out of your store or it does not have proper folder permissions configured on it. Ensure that the folder does exist with proper permissions. Alternatively, you could create the openbay.log file from your storage/logs folder and see if that rectifies the issue on that side.

Re: Moved site is redirecting and erroring out on backend

Posted: Sun Mar 08, 2020 3:05 am
by sw!tch
Whether this is a typo I don't know, but in the obfuscated examples above, you are missing home in your admin config for the storage path.

Code: Select all

define('DIR_STORAGE', '/newdomain/storage/');
to

Code: Select all

define('DIR_STORAGE', '/home/newdomain/storage/');

Re: Moved site is redirecting and erroring out on backend

Posted: Mon Mar 09, 2020 3:56 am
by brian47374
You nailed it Switch! Thanks so much. Sorry for the oversight!

Re: Moved site is redirecting and erroring out on backend

Posted: Mon Mar 09, 2020 4:11 am
by brian47374
Ok... so it resolved the backend problem. For some reason, it is still redirecting me to the old URL. I can't figure out where it is pulling the old URL from.

Re: Moved site is redirecting and erroring out on backend

Posted: Mon Mar 09, 2020 5:01 am
by sw!tch
Check .htaccess for any redirect.
Clear modification and theme cache.
Ensure your URL's are correct in the config.

Is the redirect happening on login?

Post a link to your site if you can.