0

Which things do we need to be aware of and change when moving a site (in Drupal 8) from a local environment to a server?

In Drupal 7 I would just copy the files, change the database settings in settings.php, and import database, clear all caches, and that's it.

2 problems come up with the 'move files, move database' method, which are:

  1. All links on the server-side site use the local url. Where does it get that information?
  2. When I navigate to /user/login I get this error on a white page:

    Redirects to external URLs are not allowed by default, use \Drupal\Core\Routing\TrustedRedirectResponse for it.

closed as too broad by mradcliffe, Neograph734, Clive Mar 22 '17 at 17:52

Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. Avoid asking multiple distinct questions at once. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    You should ask more than a yes or no question and expand about things that you have setup. Do you have a settings.php file with trusted host settings different from your production domain? What steps have you done? – mradcliffe Mar 22 '17 at 15:03
  • Thanks @mradcliffe. I updated my question, if you like it please upvote :) – petergus Mar 22 '17 at 16:09
  • Please ask one distinct, specific question per question, multiple unrelated questions in a single post don't work for Q+A. Many thanks – Clive Mar 22 '17 at 17:52
1

I'm assuming you're moving the files and database, as you state in your question:

Moving a site from MAMP should be pretty easy. One thing you may be missing is updating $settings['trusted_host_patterns'] in your settings.php or settings.local.php

$settings['trusted_host_patterns'] = array(
   '^mysite\.com',
   '^.+\.mysite\.com',
   '^mysite\.local',
   '^.+\.mysite\.local',
 );

Another thing you may have forgotten to do is to clear the cache once you move the files and database.

Usually I use the drush command line utility and then from the docroot of the site, or the /sites/default directly run "drush cr".

  • Comments are not for extended discussion; this conversation has been moved to chat. – Clive Mar 22 '17 at 17:53
1

I had language detection by URL turned on, with the local url in the UI form at admin/config/regional/language/detection. :)

  • In my opinion after this experience, its more versatile to use Session language detection rather than URL, at least while developing, because you can set the language parameter in the URL for the entire session. – petergus Mar 23 '17 at 11:36

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