Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Shop not working after moving from subdomain


franktechniek

Recommended Posts

Probably hard to answer this one - but any ideas where to look are welcome.

I created a new shop, a 2.3.4 BS one, placed it in a subdomain and it works like a charm. About time to put it live, so I did and nothing worked of course. After some fiddling, things started to work, the only problem was that I could not log in as a customer. Put the old shop back, and started to scratch my head.

My nest step was to rename the \includes (to \includers) folder in my old shop, and also the references to it in configure.php so that everything kept working. That allowed me to copy the \include directory from my new shop without breaking the old shop. Did a similar trick with the admin directory, and that also works like a charm.

Then I copied a single page from the new shop to the old, and that also works also:

https://www.videofrank.nl/holidays.php

Next was to rename the old login.php to login2.php and reference to make sure my old shop keeps working. Upload the new login.php file which gave an error 'Can not redeclare class cm_login_form'. I could not find any reason why this happens, and fixed it (if you call that a fix hmm) by adding a condition for the class declaration (around line 13 in cm_login_form.php) like follows:

if(('cm_login_form') === false or !class_exists('cm_login_form'))
{
  class cm_login_form {
    var $code;
    var $group;

   ................

}

That at least made the login page display itself:

http://www.videofrank.nl/login.php

But the problem is, I can not log in. It does not generate an error when I use a wrong password or non existing email address, neither does it redirect me to index.php when using a correct user email and password.

What would your next step be to investigate?

Thank you for your time,

Frank

 

 

Link to comment
Share on other sites

Thank you, but that is not the problem here. I use a new database. And everything works when my new shop sits in the subdomain I used for testing it.

Once I move the new files to my website root, the login.php is not able to handle a login.

Best regards,

Frank

 

 

Link to comment
Share on other sites

Did you correct update the definitions in includes/configure.php and admin/includes/configure.php for the new location in your main domain?

.htaccess also need to be updated if you are using rewrite rules with hardcoded domain/directory rules

Link to comment
Share on other sites

6 minutes ago, raiwa said:

Did you correct update the definitions in includes/configure.php and admin/includes/configure.php for the new location in your main domain?

.htaccess also need to be updated if you are using rewrite rules with hardcoded domain/directory rules

I think so, about the configure.php anyway.  I tried to replace the current .htaccess with the new one, which was never touched, but also makes no difference.

It is really weird ;-)

 

<?php

  define('HTTP_SERVER', 'https://' . $_SERVER["SERVER_NAME"]); // eg, http://localhost - should not be empty for productive servers
  define('HTTPS_SERVER', 'https://' . $_SERVER["SERVER_NAME"]); // eg, https://localhost - should not be empty for productive servers
//  define('HTTP_SERVER', 'http://osc234.videofrank.nl');
//  define('HTTPS_SERVER', 'http://osc234.videofrank.nl');
  define('ENABLE_SSL', true);
  define('HTTP_COOKIE_DOMAIN', '');
  define('HTTPS_COOKIE_DOMAIN', '');
  define('HTTP_COOKIE_PATH', '/');
  define('HTTPS_COOKIE_PATH', '/');
  define('DIR_WS_HTTP_CATALOG', '/');
  define('DIR_WS_HTTPS_CATALOG', '/');

//  define('DIR_FS_CATALOG', '/var/www/vhosts/videofrank.nl/osc234.videofrank.nl/');
  define('DIR_FS_CATALOG', $_SERVER["DOCUMENT_ROOT"] . '/');
  define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');
  define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');

  define('DB_SERVER', 'localhost:xxxxxxxxxxxxxxxxxxx');
  define('DB_SERVER_USERNAME', '**********************');
  define('DB_SERVER_PASSWORD', '**********************');
  define('DB_DATABASE', 'xxxxxxxxxxxxxxxxxx');
  define('USE_PCONNECT', 'false');
  define('STORE_SESSIONS', 'mysql');
  define('CFG_TIME_ZONE', 'Europe/Amsterdam');
?>

And .htaccess
#<IfModule mod_setenvif.c>
#  <IfDefine SSL>
#    SetEnvIf User-Agent ".*MSIE.*" \
#             nokeepalive ssl-unclean-shutdown \
#             downgrade-1.0 force-response-1.0
#  </IfDefine>
#</IfModule>

# If Search Engine Friendly URLs do not work, try enabling the
# following Apache configuration parameter

# AcceptPathInfo On

# Fix certain PHP values
# (commented out by default to prevent errors occuring on certain
# servers)

# php_value session.use_trans_sid 0
# php_value register_globals 1

<IfModule mod_headers.c>
  Header unset ETag
</IfModule>
FileETag None

## EXPIRES CACHING ##
## https://gtmetrix.com/leverage-browser-caching.html ##
<IfModule mod_expires.c>
ExpiresActive On
ExpiresByType image/jpg "access plus 1 year"
ExpiresByType image/jpeg "access plus 1 year"
ExpiresByType image/gif "access plus 1 year"
ExpiresByType image/png "access plus 1 year"
ExpiresByType text/css "access plus 1 month"
ExpiresByType application/pdf "access plus 1 month"
ExpiresByType text/x-javascript "access plus 1 month"
ExpiresByType application/x-shockwave-flash "access plus 1 month"
ExpiresByType image/x-icon "access plus 1 year"
ExpiresByType application/javascript "access plus 1 year"
ExpiresDefault "access plus 2 days"
</IfModule>
## EXPIRES CACHING ##

<IfModule mod_rewrite.c>
Options +FollowSymLinks
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule .* index.php [L]        
</IfModule>

 

Link to comment
Share on other sites

26 minutes ago, franktechniek said:

define('HTTP_SERVER', 'https://' . $_SERVER["SERVER_NAME"]); // eg, http://localhost - should not be empty for productive servers

this is not correct, this is the uninstalled version. It should be probably:

  define('HTTP_SERVER', 'https://www.videofrank.nl');

same in all other places.

absolute path must be also correct filled in, replace ?????

define('DIR_FS_CATALOG', '/var/www/vhosts/videofrank.nl/?????.videofrank.nl/');

you can check in the configure.php of your old store and copy from there

Link to comment
Share on other sites

42 minutes ago, raiwa said:

this is not correct, this is the uninstalled version. It should be probably:


  define('HTTP_SERVER', 'https://www.videofrank.nl');

same in all other places.

absolute path must be also correct filled in, replace ?????


define('DIR_FS_CATALOG', '/var/www/vhosts/videofrank.nl/?????.videofrank.nl/');

you can check in the configure.php of your old store and copy from there

 

Hey, this is interesting. My definitions using the $_SERVER["SERVER_NAME"] reference, all work fine. I even used that in my current/old shop, no problems. But your advice to look into the old configure.php did bring the solution.

Old configure.php:

  define('HTTP_COOKIE_DOMAIN', $_SERVER["SERVER_NAME"]);
  define('HTTPS_COOKIE_DOMAIN', $_SERVER["SERVER_NAME"]);

The new configure.php had this:

  define('HTTP_COOKIE_DOMAIN', '');
  define('HTTPS_COOKIE_DOMAIN', '');
 

So I copied those COOKIE_DOMAIN entries from the old configure.php, and all of sudden it works!

Not that I understand why - this is totally beyond me.

Thank you so much Raiwa!

Cheers,

Frank

 

 

Link to comment
Share on other sites

ok, it works, but it is not how it is usually done :smile:

empty cookie domain is produced by standard installation and should work on most hosts, but obviously not on all :smile:

Link to comment
Share on other sites

28 minutes ago, wHiTeHaT said:

  define('HTTP_COOKIE_PATH', '/');//<--just a slash is enough
  define('HTTPS_COOKIE_PATH', '/'); //<--just a slash is enough

 

Thank you Henry, above settings match mine, but for some reason I had to use this to make it work:

  define('HTTP_COOKIE_DOMAIN', $_SERVER["SERVER_NAME"]);
  define('HTTPS_COOKIE_DOMAIN', $_SERVER["SERVER_NAME"]);
 

Cheers,

Frank

 

Link to comment
Share on other sites

someone knows if there is any inconvenient using $_SERVER["SERVER_NAME"] instead of hardcoded domain?

security issue? why isn't this used in standard installation?

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...