Domain Change from .com to .org
-
19-01-2021 - |
Question
My company wants to change the domain from domain.com to domain.org, how would we do that according to moving the theme, all files, modules, etc. and keeping the Drupal integration intact?
Solution
Unlike Wordpress, Drupal doesn't care on the hostname. Unless you statically mentioned the domain in any custom modules/themes, this will be a straight forward change.
- Change the domain name using a local host file.
- Change the trusted hosts configuration (for D8, in
settings.php
) - Try accessing the site after the drupal clear cache, using
drush
.
If you are experiencing any issues, try searching for domain.com
using grep
and replace. Better to refactor the code without the domain hardcoded.
Edit: The links hard coded in WYSIWYG editors like ckeditor can create issues. You may have to update programatically or manually.
Edit2: You can use pathlogic module (not tested, d8 version is usable). to reformat the URLs in the content.