Answers.Body: <p>Pretty sure the issue is that a port number won't work as part of the key in a multi-environment config.  Because unless you explicitly set <a href="https://craftcms.com/docs/php-constants#craft-environment" rel="nofollow">CRAFT_ENVIRONMENT</a> to use it, Craft is just going to use <code>$_SERVER['SERVER_NAME']</code>, which doesn't include the <code>:port</code> (that's at <code>$_SERVER['SERVER_PORT']</code>).</p>
  
  <p>There's another thread <a href="https://craftcms.stackexchange.com/questions/1356/multi-environment-configs-and-running-sites-on-different-ports">here</a> with some solutions/workarounds.</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2016-05-18T19:27:44.557Z
Answers.LastActivityDate: 2016-05-18T19:27:44.557Z
Answers.UserDisplayName: Brad Bell
Body: <p>I have my local dev setting up using MAMP on port 8888</p>
  
  <pre><code>  'mydomain.dev:8888' =&gt; array(
      // ...
      'environmentVariables' =&gt; array(
          'basePath' =&gt; '/Users/mypath/SiteCode/mydomain/dev/',
          'baseUrl'  =&gt; '//mydomain.dev:8888/',
          'logDumpMethod' =&gt; 'print_r'
      ),
      'logDumpMethod' =&gt; 'print_r',
      'devMode' =&gt; true,
      'useCompressedJs' =&gt; true,
      'siteUrl' =&gt; array(
          'en' =&gt;  'http://mydomain.dev:8888/en/',
          'ar' =&gt;  'http://mydomain.dev:8888/ar/',
          'zh' =&gt;  'http://mydomain.dev:8888/zh/',
          'fil' =&gt; 'http://mydomain.dev:8888/fil/',
          'fr' =&gt;  'http://mydomain.dev:8888/fr/',
          'hi' =&gt;  'http://mydomain.dev:8888/hi/',
          'id' =&gt;  'http://mydomain.dev:8888/id/',
          'ru' =&gt;  'http://mydomain.dev:8888/ru/',
          'es' =&gt;  'http://mydomain.dev:8888/es/',
          'tr' =&gt;  'http://mydomain.dev:8888/tr/',
          'uk' =&gt;  'http://mydomain.dev:8888/uk/',
          'ur' =&gt;  'http://mydomain.dev:8888/ur/'
      ),
  
  ),
  </code></pre>
  
  <p>In the admin general settings I am using <code>{siteUrl}</code> for siteUrl settings. This gets read from the local dev config array as above.</p>
  
  <p>However the admin link on the site in the control panel top left gets the url wrong. 
  Instead of <code>http://mydomain.dev:8888</code> it shows
  <code>http://mydomain.dev:8888/admin/%7BsiteUrl%7D/</code></p>
  
  <p>I have other local craft sites setup with port number 8888 O.K. The only difference here is that the <code>siteUrl</code> is specified in a multilingual array.</p>
  
  <p>Is this a bug or am I missing something?</p>
  
Tags: <localization><multi-environment>
Title: Multilingual MAMP port number siteUrl issue
ThreadText: # Multilingual MAMP port number siteUrl issue
  
  (Asked by: username_0 on 2016-05-18)
  
  I have my local dev setting up using MAMP on port 8888
  
  ```
    'mydomain.dev:8888' => array(
      // ...
      'environmentVariables' => array(
          'basePath' => '/Users/mypath/SiteCode/mydomain/dev/',
          'baseUrl'  => '//mydomain.dev:8888/',
          'logDumpMethod' => 'print_r'
      ),
      'logDumpMethod' => 'print_r',
      'devMode' => true,
      'useCompressedJs' => true,
      'siteUrl' => array(
          'en' =>  'http://mydomain.dev:8888/en/',
          'ar' =>  'http://mydomain.dev:8888/ar/',
          'zh' =>  'http://mydomain.dev:8888/zh/',
          'fil' => 'http://mydomain.dev:8888/fil/',
          'fr' =>  'http://mydomain.dev:8888/fr/',
          'hi' =>  'http://mydomain.dev:8888/hi/',
          'id' =>  'http://mydomain.dev:8888/id/',
          'ru' =>  'http://mydomain.dev:8888/ru/',
          'es' =>  'http://mydomain.dev:8888/es/',
          'tr' =>  'http://mydomain.dev:8888/tr/',
          'uk' =>  'http://mydomain.dev:8888/uk/',
          'ur' =>  'http://mydomain.dev:8888/ur/'
      ),
  
  ),
  
  ```
  
  In the admin general settings I am using `{siteUrl}` for siteUrl settings. This gets read from the local dev config array as above.
  
  However the admin link on the site in the control panel top left gets the url wrong.
  Instead of `http://mydomain.dev:8888` it shows
  `http://mydomain.dev:8888/admin/%7BsiteUrl%7D/`
  
  I have other local craft sites setup with port number 8888 O.K. The only difference here is that the `siteUrl` is specified in a multilingual array.
  
  Is this a bug or am I missing something?
  
  **Tags:** localization, multi-environment
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2016-05-18. Score: 2
  
  Pretty sure the issue is that a port number won't work as part of the key in a multi-environment config. Because unless you explicitly set [CRAFT\_ENVIRONMENT](https://craftcms.com/docs/php-constants#craft-environment) to use it, Craft is just going to use `$_SERVER['SERVER_NAME']`, which doesn't include the `:port` (that's at `$_SERVER['SERVER_PORT']`).
  
  There's another thread [here](https://craftcms.stackexchange.com/questions/1356/multi-environment-configs-and-running-sites-on-different-ports) with some solutions/workarounds.
  
  
  ---
  
  