I wanted to do some testing on my CiviCRM site (on Drupal) and so copied everything over to another server. I am using CiviCRM 5.3.1 with Drupal 7.59.

I followed the steps in the "Moving an Existing Installation to a New Server or Location" guide but after re-enabling CiviCRM, when I try to navigate to any CiviCRM page I get an error in Drupal saying "Page Not Found". The CiviCRM menu link does appear in the admin menu and no errors are showing when I enable the CiviCRM module.

I have removed all the log files including the Config.IDS.ini file from the ConfigandLog folder, as well as emptying the templates_c folder. I did copy the civicrm.settings.php file over, but have updated all the paths in this file as well as updating all the entries in settings.php. I aslo emptied all the cache tables in the Civi database.

I have not been able to review and update directory paths and base URLs because of the page not found error. Not sure if I am able to do this using Drush?

I have checked the error logs for any clues, but haven't found any. There is one javascript error which comes up, which I'm not sure is relevant or not:

index.php?q=civicrm/admin:1 Refused to execute script from 'http://.../civicrm/ajax/l10n-js/en_US?r=4hXrp' because its MIME type ('text/html') is not executable, and strict MIME type checking is enabled.

Seems like I have missed something but I don't know what!

  • Can enable clean url? Commented Sep 7, 2018 at 10:48
  • Yes, it is possible to enable clean urls
    – Ben
    Commented Sep 11, 2018 at 7:58

1 Answer 1


We Always make a tar.gz from all the files, and a database backup of the drupal database and the civicrm database, without disabeling any modules. The we extract the files on the new location, and give the files and folder the right permissions (in most case 755 is good and do not forget the .htaccess). Then we ajust the settings.php and the civicrm.settings.php, with the correct paths and database connection information. Than we change the "Temporary directory" in the "File system" in drupal, and the paths in "Directories", "Resource URL's" and "Cache" in civicrm. Clear the cache again and that's it!

Don not change anything on your current website!

  • cd /var/www/html
  • tar cvzf mywebsite.tar.gz mywebsite/
  • mysqldump -u database_user_drupal -p database_name_drupal > database_name_drupal.sql
  • mysqldump -u database_user_civicrm -p database_name_civicrm > database_name_civicrm.sql Copy everything to the new server and do
  • tar -xvf mywebsite.tar.gz
  • cp -rf mywebsite/ /var/www/html/mywebsitelocation
  • chown -R username:www-data /var/www/html/mywebsitelocation/
  • chmod -R 755 /var/www/html/mywebsitelocation (or 775 for testing)
  • check the username of the DEFINER in the database_name.civicrm.sql
    • with: sed -n '/DEFINER/p' database_name.civicrm.sql
    • remove it with: sed -i 's#DEFINER=username@%# #g' database_name.civicrm.sql (replace username)
    • and: sed -i 's#DEFINER=username@localhost# #g' database_name.civicrm.sql (replace username)
    • and: sed -i 's#SQL SECURITY DEFINER#SQL SECURITY INVOKER#g' database_name.civicrm.sql
  • mysql -u new_database_user_drupal -p new_database_name_drupal < database_name_drupal.sql
  • mysql -u new_database_user_civicrm -p new_database_name_civicrm < database_name_drupal.sql
  • nano /var/www/html/mywebsitelocation/sites/default/settings.php
    • change the "$databases = array (" change the "$base_url =" (if set)
  • nano /var/www/html/mywebsitelocation/sites/default/civicrm.settings.php
    • change "define( 'CIVICRM_UF_DSN'"
    • change "define('CIVICRM_DSN'"
    • change "$civicrm_root ="
    • change "define( 'CIVICRM_TEMPLATE_COMPILEDIR'"
    • change "define( 'CIVICRM_UF_BASEURL'"
    • we do not use the "$civicrm_setting['Directory Preferences']" settings and "$civicrm_setting['URL Preferences']" settings in the civicrm.settings.php
  • change the "Temporary directory" in the "File system" in drupal
  • clear the cache, use the button in drupal
  • "Reset Paths" on "civicrm/admin/setting/updateConfigBackend?reset=1"
  • and you can clear the cache in civicrm also with the button on "civicrm/admin/setting/updateConfigBackend?reset=1"
  • Thank you Jan-Derek for responding. I did pretty much what you outlined. I tried changing the Drupal temporary directory. I cannot update the paths in "Directories", "Resource URL's" and "Cache" in civicrm, as every time I try I get the page not found error. I have cleared the cache a 100 times!
    – Ben
    Commented Sep 7, 2018 at 10:20
  • The drupal pages are working ? Can you go direct to /civicrm/admin/setting/updateConfigBackend?reset=1 ? Commented Sep 7, 2018 at 10:47
  • Thanks again for expanding on your answer. The Drupal pages are working and I have followed all the steps that you have outlined, but I cannot go directly to /civicrm/admin/setting/updateConfigBackend?reset=1 as any path beginning with /civicrm gives me the same page not found error.
    – Ben
    Commented Sep 7, 2018 at 12:00
  • And ?q=civicrm/admin/setting/updateConfigBackend&reset=1 Commented Sep 7, 2018 at 12:05
  • What for version of php are you using on the other server? And you use apache on the other server? Commented Sep 7, 2018 at 12:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.