Post by kaulekas » Wed Mar 17, 2021 5:42 pm

Hello. I am trying to run a copy of a live site on my local machine, but once I try to visit the homepage it redirects me to the live version of the site and I seem to be unable to find where that happens.
My config files point to localhost and project path points to correct path ../xampp/htdocs/shop
I have tried renaming the htaccess file.. Any suggestions welcome, please help!
Thanks

edit: I also tried his solutions but it didn't work https://stackoverflow.com/questions/279 ... -live-site

edit2: also I noticed that on the live site the default url upon visiting is ie. mysite.com/eng/e-shop so maybe there is some rule where it redirects based on the language/location however if I append that /eng/e-shop to my localhost/public_html it comes back as error object not found
Last edited by kaulekas on Wed Mar 17, 2021 8:21 pm, edited 3 times in total.

Newbie

Posts

Joined
Wed Mar 17, 2021 5:28 pm

Post by xxvirusxx » Wed Mar 17, 2021 7:59 pm

You have changed URL from HTTP_SERVER and HTTPS_SERVER?

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by kaulekas » Wed Mar 17, 2021 8:05 pm

xxvirusxx wrote:
Wed Mar 17, 2021 7:59 pm
You have changed URL from HTTP_SERVER and HTTPS_SERVER?
Yes, I've made them blank, the admin dashboard opens up and doesn't get redirected so I think that part is working fine.

Newbie

Posts

Joined
Wed Mar 17, 2021 5:28 pm

Post by kaulekas » Wed Mar 17, 2021 10:06 pm

I've tracked the redirect now to home.tpl file which only has

Code: Select all

<!DOCTYPE html>
<html>
<head>
   <!-- HTML meta refresh URL redirection -->
   <meta http-equiv="refresh"
   content="0; url=https://mysite.com/eng/eshop">
</head>
<body>
 
</body>
</html>
Now I have a new problem, I'm wondering how these links of /eng/eshop are created because as I mentioned before if I append that as ../public_html/eng/eshop it returns the object not found error.. any ideas? :)

Newbie

Posts

Joined
Wed Mar 17, 2021 5:28 pm

Post by xxvirusxx » Thu Mar 18, 2021 3:52 pm

Not Default theme?
Also check on oc_settings table from phpMyAdmin for live URL.

Upgrade Service | OC 2.3.0.2 PHP 8 | My Custom OC 3.0.3.8 | Buy me a beer


User avatar
Expert Member

Posts

Joined
Tue Jul 17, 2012 10:35 pm
Location - România

Post by kaulekas » Thu Mar 18, 2021 5:27 pm

it's default theme. What I have figured out by replacing the home.tpl file with fresh install one, is that if I enter that localhost/eshop/eng/e-shop url manually it says object not found because it is not looking for the index file which is at localhost/eshop/index.php but If I enter the url as localhost/eshop/index.php/eng/e-shop then it loads up, but all the links for scripts and stylesheets etc. get their paths skewed like localhost/eshop/index.php/eng/catalog/.../styles.css so they're basically missing from the page. But if I try to edit the the above home.tpl file to have the same link, but in the localhost format, it just keeps refreshing and doesn't ever leave the home.tpl page. As for oc_setting there is only config_seo_url which doesn't contain any link..
I'm attaching the home.php controller let me know if you need to see anything else..

Code: Select all

<?php

class ControllerCommonHome extends Controller {
	public function index() {
		
		$this->document->setTitle($this->config->get('config_meta_title'));
		$this->document->setDescription($this->config->get('config_meta_description'));
		$this->document->setKeywords($this->config->get('config_meta_keyword'));

		if (isset($this->request->get['route'])) {
			$this->document->addLink(HTTP_SERVER, 'canonical');
		}

        $this->document->addStyle('catalog/view/javascript/jquery/slick/slick.css');
        $this->document->addScript('catalog/view/javascript/jquery/slick/slick.min.js');
        $this->document->addScript('catalog/view/javascript/jquery/jquery.youtubebackground.js');

		$data['text_more'] = $this->language->get('text_more');

		$data['column_left'] = $this->load->controller('common/column_left');
		$data['column_right'] = $this->load->controller('common/column_right');
		$data['content_top'] = $this->load->controller('common/content_top');
		$data['content_bottom'] = $this->load->controller('common/content_bottom');
		$data['footer'] = $this->load->controller('common/footer');
		$data['header'] = $this->load->controller('common/header');

        $this->load->model('catalog/category');

		$this->load->model('catalog/product');
		$this->load->model('catalog/information');

		$data['categories'] = array();

		$categories = $this->model_catalog_category->getCategories(0);

        $categories = array_slice($categories, 0, 5);

		foreach ($categories as $category) {
				// Level 1
				$data['categories'][] = array(
					'name'     => $category['name'],
					'column'   => $category['column'] ? $category['column'] : 1,
					'href'     => $this->url->link('product/category', 'path=' . $category['category_id']),
					'id'       => $category['category_id'],
				);
		}

        // services page
        $servicePage = $this->model_catalog_information->getInformation(14);

        $data['categories'][] = array(
            'name' => $servicePage['title'],
            'href'     => $this->url->link('information/information', 'ipath=' . $servicePage['information_id']),
        );

		$data['categories'] = $data['categories'];

        $this->load->model('extension/module');
        $module_info = $this->model_extension_module->getModule(32);

        $this->load->model('tool/image');

        $data['banner_images'] = array();

        foreach ($module_info['banner_image'] as $banner_image) {

            $image = '';

            if (isset($banner_image['image']) && is_file(DIR_IMAGE . $banner_image['image'])) {
                $image = $this->model_tool_image->resize($banner_image['image'], 1900, 1000);
            }

            $data['banner_images'][$banner_image['sort_order']] = array(
                'banner_image_description' => $banner_image['banner_image_description'][$this->config->get('config_language_id')]['title'],
                'link'                     => $banner_image['link'],
                'image'                     => $image,
                'yt'                    => $banner_image['yt'],
            );
        }
                
                
		if (file_exists(DIR_TEMPLATE . $this->config->get('config_template') . '/template/common/home.tpl')) {
			$this->response->setOutput($this->load->view($this->config->get('config_template') . '/template/common/home.tpl', $data));
		} else {
			$this->response->setOutput($this->load->view('default/template/common/home.tpl', $data));
		}
	}
}

Newbie

Posts

Joined
Wed Mar 17, 2021 5:28 pm
Who is online

Users browsing this forum: No registered users and 32 guests