How to make a copy from development site

Have a backup copy from production site is crucial. Other than for backup purpose, production site also very important when we want to make any testing because we don't want to do it directly to production site. It's also important when we want to do the site update like module update, because sometime updating some module can break the site (because of some reason). So, it's good idea to test it first in the development site.

Here's the step to prepare making a copy:-

01) Make a database dump file
02) Copy all of the files from the web root of your live site to the web root of your development site
03) Edit the sites/default/settings.php file so that it's suite the development setting:-
03.1) trusted_host_patterns ~ disable the existing (production) & paste the code below at the end of the line
$settings['trusted_host_patterns'] = [
'^localhost$',
'^127\.0\.0\.1$',
];

03.1.1) Change the database to reflect localhost (below is database format for xampp)

$databases['default']['default'] = array (
'database' => 'databasename',
'username' => 'root',
'password' => '',
 'prefix' => '',
 'host' => 'localhost',
 'port' => '3306', 'namespace' => 'Drupal\\Core\\Database\\Driver\\mysql',
 'driver' => 'mysql',
);


03.2) Edit .htaccess file ~ find the code below:-
<IfModule mod_rewrite.c>
  RewriteEngine On # This line may already exist # Rewrite all requests to the 'www' version
  RewriteCond %{HTTP_HOST} ^sitename\.com$ [NC]
  RewriteRule ^.*$ https://www.sitename.com%{REQUEST_URI} [R=301,L] 
</IfModule>

Change it as below (disable last 3 lines)
<IfModule mod_rewrite.c>
  RewriteEngine On
# This line may already exist # Rewrite all requests to the 'www' version
 #  RewriteCond %{HTTP_HOST} ^sitename\.com$ [NC]
 #  RewriteRule ^.*$ https://www.sitename.com%{REQUEST_URI} [R=301,L] 
 # </IfModule>

Test it to make sure the site running properly

Error Fix ~ The requested URL was not found on this server:-
Before try to fix any error, it;s best to check: apache/logs/error

 

Error fix: failed to open stream: No such file or directory in.. /home/zakouz/public_html/vendor/composer/autoload_real.php on line

Run composer dump-autoload and restart your app