Answers.Body: <p>There was a rule in my .htaccess to remove www that was redirecting to the live production site. Once I removed that I needed to delete my browser cache.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2018-04-27T20:03:00.737Z
Answers.LastActivityDate: 2018-04-27T20:03:00.737Z
Answers.UserDisplayName: patrick.altair
Body: <p>I've imported a craft install and its database from a production site to make some changes to it. I've set it up to work locally in MAMP but whenever I go to example.local it keeps redirecting me to example.com. I'm using a multi-environment config so I'm not sure where it could be going wrong.</p>
  
  <pre><code>return array(
  
  // Applies to all enviroments
  '*' =&gt; array(
  
      // Base site URL
      'siteUrl' =&gt; null,
  
      // Environment-specific variables (see https://craftcms.com/docs/multi-environment-configs#environment-specific-variables)
      'environmentVariables' =&gt; array(),
  
      // Default Week Start Day (0 = Sunday, 1 = Monday...)
      'defaultWeekStartDay' =&gt; 0,
  
      // Enable CSRF Protection (recommended, will be enabled by default in Craft 3)
      'enableCsrfProtection' =&gt; true,
  
      // Whether "index.php" should be visible in URLs (true, false, "auto")
      'omitScriptNameInUrls' =&gt; 'auto',
  
      // Control Panel trigger word
      'cpTrigger' =&gt; 'admin',
  
      // Dev Mode (see https://craftcms.com/support/dev-mode)
      'devMode' =&gt; false,
  
      // Preserve Image’s Colour Profiles 
      'preserveImageColorProfiles' =&gt; true
  
  ),
  
  // Applies just to local dev server
  '.local' =&gt; array(
      // Site URL
      'siteUrl' =&gt; "http://example.local:8888/",
  
      // Devmode
      'devMode' =&gt; true,
  
      // Turn off timeout
      'userSessionDuration' =&gt; false,
  
      // Image assets paths
      'environmentVariables' =&gt; array(
          'basePath' =&gt; '',
          'baseUrl'  =&gt; 'http://example.local:8888/',
      )
  ),
  
  // Applies to production site
  '.com' =&gt; array(
      // Site URL
      'siteUrl' =&gt; "http://example.com/",
      // Devmode
      'devMode' =&gt; false,
  
      // Image assets paths
      'environmentVariables' =&gt; array(
          'basePath' =&gt; '',
          'baseUrl'  =&gt; 'http://example.com/',
      )
  )
  );
  </code></pre>
  
  <p>And my current .htaccess</p>
  
  <pre><code>&lt;IfModule mod_rewrite.c&gt;
  RewriteEngine On
  
  # Send would-be 404 requests to Craft
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]
  RewriteRule (.+) index.php?p=$1 [QSA,L]
  </code></pre>
  
  <p></p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-04-27T07:13:21.447Z
Comments.Text: Anything weird regarding redirects in your .htaccess file? Is it perhaps redirecting everything immediatly to your TLD?
Comments.UserDisplayName: Gįëł Tėttëłæår
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-04-27T18:55:04.150Z
Comments.Text: Good spot @GįëłTėttëłæår. I had a rewrite rule to get rid of www. from URLs which was going to the TLD but weirdly even when I remove that from the .htaccess I'm still getting redirected...
Comments.UserDisplayName: patrick.altair
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-04-27T20:00:50.827Z
Comments.Text: Working now, just had to delete my browser cache. Thanks!
Comments.UserDisplayName: patrick.altair
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2018-04-30T19:47:26.727Z
Comments.Text: Glad to hear its fixed!
Comments.UserDisplayName: Gįëł Tėttëłæår
Tags: <config><mamp>
Title: Local MAMP site keeps redirecting to live production site
ThreadText: # Local MAMP site keeps redirecting to live production site
  
  (Asked by: username_0 on 2018-04-27)
  
  I've imported a craft install and its database from a production site to make some changes to it. I've set it up to work locally in MAMP but whenever I go to example.local it keeps redirecting me to example.com. I'm using a multi-environment config so I'm not sure where it could be going wrong.
  
  ```
  return array(
  
  // Applies to all enviroments
  '*' => array(
  
      // Base site URL
      'siteUrl' => null,
  
      // Environment-specific variables (see https://craftcms.com/docs/multi-environment-configs#environment-specific-variables)
      'environmentVariables' => array(),
  
      // Default Week Start Day (0 = Sunday, 1 = Monday...)
      'defaultWeekStartDay' => 0,
  
      // Enable CSRF Protection (recommended, will be enabled by default in Craft 3)
      'enableCsrfProtection' => true,
  
      // Whether "index.php" should be visible in URLs (true, false, "auto")
      'omitScriptNameInUrls' => 'auto',
  
      // Control Panel trigger word
      'cpTrigger' => 'admin',
  
      // Dev Mode (see https://craftcms.com/support/dev-mode)
      'devMode' => false,
  
      // Preserve Image’s Colour Profiles 
      'preserveImageColorProfiles' => true
  
  ),
  
  // Applies just to local dev server
  '.local' => array(
      // Site URL
      'siteUrl' => "http://example.local:8888/",
  
      // Devmode
      'devMode' => true,
  
      // Turn off timeout
      'userSessionDuration' => false,
  
      // Image assets paths
      'environmentVariables' => array(
          'basePath' => '',
          'baseUrl'  => 'http://example.local:8888/',
      )
  ),
  
  // Applies to production site
  '.com' => array(
      // Site URL
      'siteUrl' => "http://example.com/",
      // Devmode
      'devMode' => false,
  
      // Image assets paths
      'environmentVariables' => array(
          'basePath' => '',
          'baseUrl'  => 'http://example.com/',
      )
  )
  );
  
  ```
  
  And my current .htaccess
  
  ```
  <IfModule mod_rewrite.c>
  RewriteEngine On
  
  # Send would-be 404 requests to Craft
  RewriteCond %{REQUEST_FILENAME} !-f
  RewriteCond %{REQUEST_FILENAME} !-d
  RewriteCond %{REQUEST_URI} !^/(favicon\.ico|apple-touch-icon.*\.png)$ [NC]
  RewriteRule (.+) index.php?p=$1 [QSA,L]
  
  ```
  
  **Tags:** config, mamp
  
  > **Comments:**
  > **username_1**: Anything weird regarding redirects in your .htaccess file? Is it perhaps redirecting everything immediatly to your TLD?  
  > **username_0**: Good spot @username_1. I had a rewrite rule to get rid of www. from URLs which was going to the TLD but weirdly even when I remove that from the .htaccess I'm still getting redirected...  
  > **username_0**: Working now, just had to delete my browser cache. Thanks!  
  > **username_1**: Glad to hear its fixed!  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2018-04-27. Score: 1 | Accepted answer
  
  There was a rule in my .htaccess to remove www that was redirecting to the live production site. Once I removed that I needed to delete my browser cache.
  
  
  ---
  
  