Copying Site to subdomain

Summary

I have copied my existing site to an subdomain in order to make changes before devolopping a new version. I copied all the files, create a copy of the database. Adapted the paths in
/config.core.php
/connectors/config.core.php
/manager/config.core.php
Deleted the cache folder.

Observed behavior

After starting now the page I get the error 503 Service temporally unavailible with the text on the page: Site temporarily unavailable.

In the error.log in the cache folder I have following error:
[2021-12-19 18:21:08] (ERROR in xPDOConnection::connect @ /homepages/33/XXXXXX/htdocs/test/core/xpdo/xpdo.class.php : 3119) SQLSTATE[HY000] [1044] Access denied for user ‘o5086389’@’%’ to database 'db50060xxxxx’

I do not have an user o5086389 and do not know, where this is coming from.

Expected behavior

It should work :slight_smile:

Environment

MODX Revolution 2.8.3-pl, MYSQL 5.7 (Source was MYSQL 5.5), PHP 7.4, Ionos Hosting

Hi @alfi65,

Did you update your database details in core/config/config.inc.php … to reflect your new database?

<?php
/**
 *  MODX Configuration file
 */
$database_type = 'mysql';
$database_server = 'localhost';
$database_user = 'db_user_name';
$database_password = 'db_user_password';
$database_connection_charset = 'utf8';
$dbase = 'database_name';
$table_prefix = 'modx_';
$database_dsn = 'mysql:host=localhost;dbname=database_name;charset=utf8';
$config_options = array (
);
$driver_options = array (
);

Yes, of course I did it :slight_smile:

@dejaya I have tested now, if I do not update the database details, it works, but then I am working with the original database. I tried also to install modx over it and make an Update. The test of the database is ok, so the data and password is correct, but i cannot install.

Did you update the .htaccess file for the new domain?

@bobray I only removed the automatic attachement of “www” at the end.

# MODX supports Friendly URLs via this .htaccess file. You must serve web
# pages via Apache with mod_rewrite to use this functionality, and you must
# change the file name from ht.access to .htaccess.
#
# Make sure RewriteBase points to the directory where you installed MODX.
# E.g., "/modx" if your installation is in a "modx" subdirectory.
#
# You may choose to make your URLs non-case-sensitive by adding a NC directive
# to your rule: RewriteRule ^(.*)$ index.php?q=$1 [L,QSA,NC]

RewriteEngine On
RewriteBase /



# Rewrite www.domain.com -> domain.com -- used with SEO Strict URLs plugin
#RewriteCond %{HTTP_HOST} .
#RewriteCond %{HTTP_HOST} ^www.(.*)$ [NC]
#RewriteRule ^(.*)$ http://%1/$1 [R=301,L]
#
# or for the opposite domain.com -> www.domain.com use the following
# DO NOT USE BOTH
#
#RewriteCond %{HTTP_HOST} !^$
#RewriteCond %{HTTP_HOST} !^www\. [NC]
#RewriteCond %{HTTP_HOST} (.+)$
#RewriteRule ^(.*)$ http://www.%1/$1 [R=301,L] .



# Rewrite secure requests properly to prevent SSL cert warnings, e.g. prevent 
# https://www.domain.com when your cert only allows https://secure.domain.com
#RewriteCond %{SERVER_PORT} !^443
#RewriteRule (.*) https://example-domain-please-change.com/$1 [R=301,L]



# The Friendly URLs part
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?q=$1 [L,QSA]



# Make sure .htc files are served with the proper MIME type, which is critical
# for XP SP2. Un-comment if your host allows htaccess MIME type overrides.

#AddType text/x-component .htc



# If your server is not already configured as such, the following directive
# should be uncommented in order to set PHP's register_globals option to OFF.
# This closes a major security hole that is abused by most XSS (cross-site
# scripting) attacks. For more information: http://php.net/register_globals
#
# To verify that this option has been set to OFF, open the Manager and choose
# Reports -> System Info and then click the phpinfo() link. Do a Find on Page
# for "register_globals". The Local Value should be OFF. If the Master Value
# is OFF then you do not need this directive here.
#
# IF REGISTER_GLOBALS DIRECTIVE CAUSES 500 INTERNAL SERVER ERRORS :
#
# Your server does not allow PHP directives to be set via .htaccess. In that
# case you must make this change in your php.ini file instead. If you are
# using a commercial web host, contact the administrators for assistance in
# doing this. Not all servers allow local php.ini files, and they should
# include all PHP configurations (not just this one), or you will effectively
# reset everything to PHP defaults. Consult www.php.net for more detailed
# information about setting PHP directives.

#php_flag register_globals Off



# For servers that support output compression, you should pick up a bit of
# speed by un-commenting the following lines.

#php_flag zlib.output_compression On
#php_value zlib.output_compression_level 5



# The following directives stop screen flicker in IE on CSS rollovers. If
# needed, un-comment the following rules. When they're in place, you may have
# to do a force-refresh in order to see changes in your designs.

#ExpiresActive On
#ExpiresByType image/gif A2592000
#ExpiresByType image/jpeg A2592000
#ExpiresByType image/png A2592000
#BrowserMatch "MSIE" brokenvary=1
#BrowserMatch "Mozilla/4.[0-9]{2}" brokenvary=1
#BrowserMatch "Opera" !brokenvary
#SetEnvIf brokenvary 1 force-no-vary

<IfModule mod_deflate.c>
AddOutputFilterByType DEFLATE text/plain
AddOutputFilterByType DEFLATE text/html
AddOutputFilterByType DEFLATE text/xml
AddOutputFilterByType DEFLATE text/shtml
AddOutputFilterByType DEFLATE text/css
AddOutputFilterByType DEFLATE application/xml
AddOutputFilterByType DEFLATE application/xhtml+xml
AddOutputFilterByType DEFLATE application/rss+xml
AddOutputFilterByType DEFLATE application/javascript
AddOutputFilterByType DEFLATE application/x-javascript
</IfModule> 

RewriteCond %{HTTPS} off
# First rewrite to HTTPS:
# Don't put www. here. If it is already there it will be included, if not
# the subsequent rule will catch it.
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]


# Now, rewrite any request to the wrong domain to use www.
#- RewriteCond %{HTTP_HOST} !^www\.**
#- RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]**

Double check the core/config/config.inc.php file, especially every specification of the db name, username, and password. Also check the paths and URLs, keeping in mind which is which.