Post by mminten » Sat Aug 26, 2017 9:14 am

I just set up a development copy of our live site on a subdomain. I have a different database for the dev site but all the info in it is the same. If I go to the subdomain it appears to be correct. The problem is that all the links on the dev site point to the live site, the navigation menu, the products and even the admin login after logging in.

Live site: https://garrysun.com/
Dev site: https://dev.garrysun.com/

Process:
1. Downloaded copies of site and database.
2. Created a subdomain on my hosting account and pointed it to the dev folder in my root directory.
3. Created a new database and user/pass.
4. Uploaded all files to the new folder and the copy of the database to the new database.
5. Changed the locations in both root and admin config. The http/https URLs are now dev subdomain in the top section and the DIR bottom section shows the location from the root directory up to the dev folder. Database info has also been changed.
6. I cleared cookies and history and hit CTRL +F5 at least 5 times.

How can I get the subdomain to point to itself?
Do I have to change something in the database?

Active Member

Posts

Joined
Tue Nov 20, 2012 9:33 am


Post by IP_CAM » Sat Aug 26, 2017 10:49 am

well, you forgot to mention the .htaccess file RewriteEngine Setting in each Shop!
Ernie

Code: Select all

# SEO URL Settings
RewriteEngine On
# If your opencart installation does not run on the main web folder,
# make sure you folder it does run in ie. / becomes /shop/
RewriteBase /shop/

I'm rarely active at the OC Forum lately. To reach me, contact: jti@jacob.ch
A Demoversion of my free OpenCart LIGHT v.1.5.6.5 Software Edition
can be seen in real Action here: http://www.jti.li/shop/
---
1'300+ FREE OC Extension-Repositories - from OC v.1.5.x up,
on the world's largest OC-related Github Site: https://github.com/IP-CAM
---
Image


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by mminten » Sat Aug 26, 2017 12:01 pm

So I changed it but it still doesn't work.

Code: Select all

# SEO URL Settings
RewriteEngine On
# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/ 

RewriteBase /dev/
And farther down I changed:

Code: Select all

RewriteCond %{HTTP_HOST} ^www\.garrysun\.com [NC]
 RewriteRule ^(.*)$ https://garrysun.com/$1 [L,R=301]
To:

Code: Select all

RewriteCond %{HTTP_HOST} ^www\.dev\.garrysun\.com [NC]
 RewriteRule ^(.*)$ https://dev.garrysun.com/$1 [L,R=301]
What else might I be missing?

Active Member

Posts

Joined
Tue Nov 20, 2012 9:33 am


Post by opencartboost » Sat Aug 26, 2017 11:53 pm

Do you set file config.php and admin/config.php with correct?
Do you set correctly for store url in admin setting store?

Active Member

Posts

Joined
Thu Jul 09, 2015 5:59 am

Post by mminten » Sun Aug 27, 2017 7:00 am

Yes the config files are correct. For the top section everything points to the url https://dev.garrysun.com. The bottom section points to the path on the server .../public_html/dev.

Active Member

Posts

Joined
Tue Nov 20, 2012 9:33 am


Post by IP_CAM » Sun Aug 27, 2017 10:45 am

Well, the BASE HREF Entry in your HEADER Section tells us something different:
<base href="https://garrysun.com/" />
Ernie

I'm rarely active at the OC Forum lately. To reach me, contact: jti@jacob.ch
A Demoversion of my free OpenCart LIGHT v.1.5.6.5 Software Edition
can be seen in real Action here: http://www.jti.li/shop/
---
1'300+ FREE OC Extension-Repositories - from OC v.1.5.x up,
on the world's largest OC-related Github Site: https://github.com/IP-CAM
---
Image


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by opencartboost » Sun Aug 27, 2017 4:10 pm

<base href="https://garrysun.com/" /> come from config_url, that's why i ask owner to check correctly for config store url in admin setting store.

Active Member

Posts

Joined
Thu Jul 09, 2015 5:59 am

Post by mminten » Mon Aug 28, 2017 11:38 pm

Ok, below are copies of what I have in the config files (slightly edited, obviously I am not going to add my DB info and I edited the directory structure for //DIR for security)...

I am using version 1.5.4 because the site is old. Part of the need for a dev site is to upgrade it.

The domain I want is https://dev.garrysun.com which is pointing to my root directory (public_html/dev/). I am unsure if the SSL will apply to the subdomain but even if I try without https it doesn't work. I am not sure why the base url shows the actual live site and not the dev site if I have this info installed. I have quadruple checked that the files are uploaded correctly. Could it be something else with the subdomain?

.../config.php

Code: Select all

// HTTP
define('HTTP_SERVER', 'http://dev.garrysun.com/');
define('HTTP_IMAGE', 'http://dev.garrysun.com/image/');
define('HTTP_ADMIN', 'http://dev.garrysun.com/admin/');

// HTTPS
define('HTTPS_SERVER', 'https://dev.garrysun.com/');
define('HTTPS_IMAGE', 'https://dev.garrysun.com/image/');

// DIR
define('DIR_APPLICATION', '/public_html/dev/catalog/');
define('DIR_SYSTEM', '/public_html/dev/system/');
define('DIR_DATABASE', '/public_html/dev/system/database/');
define('DIR_LANGUAGE', '/public_html/dev/catalog/language/');
define('DIR_TEMPLATE', '/public_html/dev/catalog/view/theme/');
define('DIR_CONFIG', '/public_html/dev/system/config/');
define('DIR_IMAGE', '/public_html/dev/image/');
define('DIR_CACHE', '/public_html/dev/system/cache/');
define('DIR_DOWNLOAD', '/public_html/dev/download/');
define('DIR_LOGS', '/public_html/dev/system/logs/');
.../admin/config.php:

Code: Select all

// HTTP
define('HTTP_SERVER', 'http://dev.garrysun.com/admin/');
define('HTTP_CATALOG', 'http://dev.garrysun.com/');
define('HTTP_IMAGE', 'http://dev.garrysun.com/image/');

// HTTPS
define('HTTPS_SERVER', 'https://dev.garrysun.com/admin/');
define('HTTPS_CATALOG', 'https://dev.garrysun.com/');
define('HTTPS_IMAGE', 'https://dev.garrysun.com/image/');

// DIR
define('DIR_APPLICATION', '/public_html/dev/admin/');
define('DIR_SYSTEM', '/public_html/dev/system/');
define('DIR_DATABASE', '/public_html/dev/system/database/');
define('DIR_LANGUAGE', '/public_html/dev/admin/language/');
define('DIR_TEMPLATE', '/public_html/dev/admin/view/template/');
define('DIR_CONFIG', '/public_html/dev/system/config/');
define('DIR_IMAGE', '/public_html/dev/image/');
define('DIR_CACHE', '/public_html/dev/system/cache/');
define('DIR_DOWNLOAD', '/public_html/dev/download/');
define('DIR_LOGS', '/public_html/dev/system/logs/');
define('DIR_CATALOG', '/public_html/dev/catalog/');
Thanks again for all your help on this everyone!

Active Member

Posts

Joined
Tue Nov 20, 2012 9:33 am


Post by opencartboost » Tue Aug 29, 2017 1:26 am

Please go to admin -> system -> settings. At list your store, please make sure for store url is http://dev.garrysun.com/

Active Member

Posts

Joined
Thu Jul 09, 2015 5:59 am

Post by mminten » Tue Aug 29, 2017 1:40 am

So, unfortunately I can't login to the dev site because it redirects me to the live site. Where is this setting in the database so I can change it there?

Active Member

Posts

Joined
Tue Nov 20, 2012 9:33 am


Post by IP_CAM » Tue Aug 29, 2017 2:10 am

well, if you use https:, your config.php files have to look like this:

Code: Select all

// HTTP
define('HTTP_SERVER', 'https://dev.garrysun.com/admin/');
define('HTTP_CATALOG', 'https://dev.garrysun.com/');
define('HTTP_IMAGE', 'https://dev.garrysun.com/image/');

// HTTPS
define('HTTPS_SERVER', 'https://dev.garrysun.com/admin/');
define('HTTPS_CATALOG', 'https://dev.garrysun.com/');
define('HTTPS_IMAGE', 'https://dev.garrysun.com/image/');
But it also may be to some .htaccess REWRITE Content, also
related to this.
Ernie

I'm rarely active at the OC Forum lately. To reach me, contact: jti@jacob.ch
A Demoversion of my free OpenCart LIGHT v.1.5.6.5 Software Edition
can be seen in real Action here: http://www.jti.li/shop/
---
1'300+ FREE OC Extension-Repositories - from OC v.1.5.x up,
on the world's largest OC-related Github Site: https://github.com/IP-CAM
---
Image


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by opencartboost » Tue Aug 29, 2017 2:15 am

ups sorry, by check a gain file store.php at admin/controller/setting/store.php
for default store (store_id = 0), store url use HTTP_CATALOG as code below:

Code: Select all

$this->data['stores'][] = array(
			'store_id' => 0,
			'name'     => $this->config->get('config_name') . $this->language->get('text_default'),
			'url'      => HTTP_CATALOG,
			'selected' => isset($this->request->post['selected']) && in_array(0, $this->request->post['selected']),
			'action'   => $action
		);
and from file admin/config.php your setting is correct.

May be you need check database for table setting.
Also make sure you are not change file header.php at catalog/controller/common/header.php

Active Member

Posts

Joined
Thu Jul 09, 2015 5:59 am

Post by IP_CAM » Tue Aug 29, 2017 2:23 am

But with this:
'url' => HTTP_CATALOG,
only, if the HTTP_CATALOG config.php setting is set to HTTPS, as I documented above!
Ernie

I'm rarely active at the OC Forum lately. To reach me, contact: jti@jacob.ch
A Demoversion of my free OpenCart LIGHT v.1.5.6.5 Software Edition
can be seen in real Action here: http://www.jti.li/shop/
---
1'300+ FREE OC Extension-Repositories - from OC v.1.5.x up,
on the world's largest OC-related Github Site: https://github.com/IP-CAM
---
Image


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by mminten » Tue Aug 29, 2017 3:18 am

I have this in my htaccess file:

Code: Select all

RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
 RewriteCond %{HTTP_HOST} ^www\.dev\.garrysun\.com [NC]
 RewriteRule ^(.*)$ https://dev.garrysun.com/$1 [L,R=301]
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Is it incorrect?

I changed the config files to use all https: and not http: in the first few lines.

IP_CAM and opencartboost, I am not sure what you are saying about the store.php file. Do I need to change something there? Mine is the same as the code above. It says it should use HTTP_CATALOG but in the config files HTTP_CATALOG is pointing to the correct url.

If I need to change something in the database where do I change it? Which table? I have searched for the url but it doesn't seem to come up anywhere that is related to the store settings.

Active Member

Posts

Joined
Tue Nov 20, 2012 9:33 am


Post by IP_CAM » Tue Aug 29, 2017 3:38 am

Unfortunately, OC is an open software, and some Code and Extensions
uses 'internally' either http or SSL by default. So, whatever call has been done,
it NEEDS to be re-linked to https, by Nature of things.
Just try, what we tell you, before asking questions, you cannot ruin anything! ;)
Ernie

I'm rarely active at the OC Forum lately. To reach me, contact: jti@jacob.ch
A Demoversion of my free OpenCart LIGHT v.1.5.6.5 Software Edition
can be seen in real Action here: http://www.jti.li/shop/
---
1'300+ FREE OC Extension-Repositories - from OC v.1.5.x up,
on the world's largest OC-related Github Site: https://github.com/IP-CAM
---
Image


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by mminten » Tue Aug 29, 2017 4:11 am

I apologize IP_CAM but I don't understand what your suggestion was. To me it seemed like you had said to change the config files to use all https instead of http. Now I have these config files:

Admin config.php

Code: Select all

// HTTP
define('HTTP_SERVER', 'https://dev.garrysun.com/admin/');
define('HTTP_CATALOG', 'https://dev.garrysun.com/');
define('HTTP_IMAGE', 'https://dev.garrysun.com/image/');

// HTTPS
define('HTTPS_SERVER', 'https://dev.garrysun.com/admin/');
define('HTTPS_CATALOG', 'https://dev.garrysun.com/');
define('HTTPS_IMAGE', 'https://dev.garrysun.com/image/');
and config.php

Code: Select all

// HTTP
define('HTTP_SERVER', 'https://dev.garrysun.com/');
define('HTTP_IMAGE', 'https://dev.garrysun.com/image/');
define('HTTP_ADMIN', 'https://dev.garrysun.com/admin/');

// HTTPS
define('HTTPS_SERVER', 'https://dev.garrysun.com/');
define('HTTPS_IMAGE', 'https://dev.garrysun.com/image/');
Am I missing something for your suggestions?

Active Member

Posts

Joined
Tue Nov 20, 2012 9:33 am


Post by IP_CAM » Tue Aug 29, 2017 5:11 am

Negative, that's, what I meant. ;)

But also make sure to have set a correct
RewriteBase path set in each of the both .htaccess files,
like:

Code: Select all

RewriteBase /shop/
and:
RewriteBase /dev/
Ernie

I'm rarely active at the OC Forum lately. To reach me, contact: jti@jacob.ch
A Demoversion of my free OpenCart LIGHT v.1.5.6.5 Software Edition
can be seen in real Action here: http://www.jti.li/shop/
---
1'300+ FREE OC Extension-Repositories - from OC v.1.5.x up,
on the world's largest OC-related Github Site: https://github.com/IP-CAM
---
Image


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by mminten » Tue Aug 29, 2017 7:08 am

I have:

Code: Select all

# SEO URL Settings
RewriteEngine On
# If your opencart installation does not run on the main web folder make sure you folder it does run in ie. / becomes /shop/ 

RewriteBase /dev/
RewriteRule ^sitemap.xml$ index.php?route=feed/google_sitemap [L]
RewriteRule ^googlebase.xml$ index.php?route=feed/google_base [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !.*\.(ico|gif|jpg|jpeg|png|js|css)
RewriteRule ^([^?]*) index.php?_route_=$1 [L,QSA]
 RewriteCond %{HTTP_HOST} ^www\.dev\.garrysun\.com [NC]
 RewriteRule ^(.*)$ https://dev.garrysun.com/$1 [L,R=301]
RewriteCond %{HTTPS} !on
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
in my root level .htaccess where is the other .htaccess? I don't see one in admin and you said "But also make sure to have set a correct
RewriteBase path set in each of the both .htaccess files "

Active Member

Posts

Joined
Tue Nov 20, 2012 9:33 am


Post by IP_CAM » Tue Aug 29, 2017 7:50 pm

Well, EACH ONE of your Shops uses it's own .htaccess File !
Ernie

I'm rarely active at the OC Forum lately. To reach me, contact: jti@jacob.ch
A Demoversion of my free OpenCart LIGHT v.1.5.6.5 Software Edition
can be seen in real Action here: http://www.jti.li/shop/
---
1'300+ FREE OC Extension-Repositories - from OC v.1.5.x up,
on the world's largest OC-related Github Site: https://github.com/IP-CAM
---
Image


User avatar
Legendary Member

Posts

Joined
Tue Mar 04, 2014 1:37 am
Location - Switzerland

Post by mminten » Wed Aug 30, 2017 2:27 am

Ok, I still don't get it. I have a live site at garrysun.com that I don't want to change at all. I am just dealing with the dev site at dev.garrysun.com. There is a wholesale site for different users but the .htaccess file has nothing in it really.

Code: Select all

# Use PHP5.4 as default
AddHandler application/x-httpd-php54 .php
What .htaccess would I have to change other than the root .htaccess in dev.garrysun.com? Is there anything in the code in my last post that is incorrect?

The big question is that if the config files are all correct and the htaccess file is correct why do all the links in dev.garrysun.com point back to the live site? Is there a database field that I need to change or should I just set up the dev site in a subfolder like garrysun.com/dev and give up? I really wanted it in the subdomain so it is less likely to be found but users/search engines.

Thanks again, I really appreciate all your tips.

Active Member

Posts

Joined
Tue Nov 20, 2012 9:33 am

Who is online

Users browsing this forum: Baidu [Spider] and 12 guests