Answers.Body: <p>This is solved by <a href="https://craftcms.stackexchange.com/questions/2545/urls-other-than-index-cause-500-internal-server-error">this thread</a>. </p>
  
  <p>The common thread here is Rackspace Cloud Sites, which apparently needs a <code>RewriteBase /</code> instruction in <code>.htaccess</code>. </p>
  
  <p>Thanks @maxx and @christopher-healey</p>
  
Answers.ContentLicense: CC BY-SA 3.0
Answers.CreationDate: 2015-09-04T02:35:02.653Z
Answers.LastActivityDate: 2015-09-04T02:35:02.653Z
Answers.LastEditDate: 2017-04-13T12:50:59.930Z
Answers.UserDisplayName: plaintxt
Body: <p>I've developed my site locally and now need to migrate to staging. The Home page is displaying correctly so I would assume that a database connection is not the issue. But requesting <code>{staging_url}/{any_segment}</code> results in a 500 Internal Server error.</p>
  
  <p>Here I'm setting the environment in <code>index.php</code>:</p>
  
  <pre><code>if (substr($_SERVER['SERVER_NAME'], -strlen('.dev')) === '.dev') {
      define('CRAFT_ENVIRONMENT', 'development');
  } else if ($_SERVER['SERVER_NAME'] == 'staging.blah.com') {
      define('CRAFT_ENVIRONMENT', 'staging');
  } else {
      define('CRAFT_ENVIRONMENT', 'production');
  }
  </code></pre>
  
  <p>Here's my <code>general.php</code>:</p>
  
  <pre><code>return array(
      '*' =&gt; array(
          'extraAllowedFileExtensions' =&gt; 'vcf',
          'omitScriptNameInUrls' =&gt; true,
      ),
      'development' =&gt; array(
          'devMode' =&gt; true,
          'siteUrl' =&gt; 'http://blah.dev',
          'environmentVariables' =&gt; array(
              'baseUrl' =&gt; 'http://blah.dev',
          ),
      ),
      'staging' =&gt; array(
          'siteUrl' =&gt; 'http://staging.blah.com',
          'environmentVariables' =&gt; array(
              'baseUrl' =&gt; 'http://staging.blah.com',
          ),
      ),
      'production' =&gt; array(
          'siteUrl' =&gt; 'http://blah.com',
          'environmentVariables' =&gt; array(
              'baseUrl' =&gt; 'http://blah.com',
          ),
      ),
  );
  </code></pre>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-09-03T22:37:13.610Z
Comments.Text: I don't know if it's the cause of your issue, but `if (substr($_SERVER['SERVER_NAME'], -strlen('.dev')) === '.dev' !== FALSE)` isn't valid PHP syntax.
Comments.UserDisplayName: Brad Bell
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-09-04T01:23:26.563Z
Comments.Text: Ha I shortened that line before posting because it caused a wrap in the preview- I thought I had the right syntax but I guess not. Anyway, I don't think that's it.
  
  Can you please help me understand the difference between siteUrl and baseUrl?
  
  Also, could this possibly be due to a bad Settings > General > Site URL value when I did the db export / import? I added the siteUrl override after the migration.
Comments.UserDisplayName: plaintxt
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-09-04T02:25:03.307Z
Comments.Text: This has something to do with index.php being absent in the requested URL.
Comments.UserDisplayName: plaintxt
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2015-09-04T02:33:56.620Z
Comments.Text: @subtlegusto Could you add your fix as an answer so this question is marked as answered/complete. Thanks :)
Comments.UserDisplayName: j00lz
Tags: <error-message><install><apache>
Title: After migration to staging, requesting any page other than Home results in 500 error
ThreadText: # After migration to staging, requesting any page other than Home results in 500 error
  
  (Asked by: username_0 on 2015-09-03)
  
  I've developed my site locally and now need to migrate to staging. The Home page is displaying correctly so I would assume that a database connection is not the issue. But requesting `{staging_url}/{any_segment}` results in a 500 Internal Server error.
  
  Here I'm setting the environment in `index.php`:
  
  ```
  if (substr($_SERVER['SERVER_NAME'], -strlen('.dev')) === '.dev') {
      define('CRAFT_ENVIRONMENT', 'development');
  } else if ($_SERVER['SERVER_NAME'] == 'staging.blah.com') {
      define('CRAFT_ENVIRONMENT', 'staging');
  } else {
      define('CRAFT_ENVIRONMENT', 'production');
  }
  
  ```
  
  Here's my `general.php`:
  
  ```
  return array(
      '*' => array(
          'extraAllowedFileExtensions' => 'vcf',
          'omitScriptNameInUrls' => true,
      ),
      'development' => array(
          'devMode' => true,
          'siteUrl' => 'http://blah.dev',
          'environmentVariables' => array(
              'baseUrl' => 'http://blah.dev',
          ),
      ),
      'staging' => array(
          'siteUrl' => 'http://staging.blah.com',
          'environmentVariables' => array(
              'baseUrl' => 'http://staging.blah.com',
          ),
      ),
      'production' => array(
          'siteUrl' => 'http://blah.com',
          'environmentVariables' => array(
              'baseUrl' => 'http://blah.com',
          ),
      ),
  );
  
  ```
  
  **Tags:** error-message, install, apache
  
  > **Comments:**
  > **username_1**: I don't know if it's the cause of your issue, but `if (substr($_SERVER['SERVER_NAME'], -strlen('.dev')) === '.dev' !== FALSE)` isn't valid PHP syntax.  
  > **username_0**: Ha I shortened that line before posting because it caused a wrap in the preview- I thought I had the right syntax but I guess not. Anyway, I don't think that's it.  Can you please help me understand the difference between siteUrl and baseUrl?  Also, could this possibly be due to a bad Settings > General > Site URL value when I did the db export / import? I added the siteUrl override after the migration.  
  > **username_0**: This has something to do with index.php being absent in the requested URL.  
  > **username_2**: @subtlegusto Could you add your fix as an answer so this question is marked as answered/complete. Thanks :)  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_0 on 2015-09-04. Score: 2
  
  This is solved by [this thread](https://craftcms.stackexchange.com/questions/2545/urls-other-than-index-cause-500-internal-server-error).
  
  The common thread here is Rackspace Cloud Sites, which apparently needs a `RewriteBase /` instruction in `.htaccess`.
  
  Thanks @maxx and @christopher-healey
  
  
  ---
  
  