Common causes of WordPress Error 500 with index.php and solutions

Solution:

1. Check WordPress URLs:

  • WordPress Address (URL): www.mydomain.com/site/
  • Site Address (URL): www.mydomain.com

2. Update your root .htaccess file (replace mydomain.com with your domain):


<IfModule mod_rewrite.c>
    RewriteEngine on

    # Redirect all requests to /site/ except existing files and directories
    RewriteCond %{HTTP_HOST} ^(www\.)?mydomain.com$
    RewriteCond %{REQUEST_URI} !^/site/
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)$ /site/$1

    # Handle root requests
    RewriteCond %{HTTP_HOST} ^(www\.)?mydomain.com$
    RewriteRule ^(/)?$ site/index.php [L]
</IfModule>

3. Modify the root index.php file:

Change:


<?php
require( dirname( __FILE__ ) . '/site/wp-blog-header.php' );
?>

To:


<?php
require('/site/wp-blog-header.php');
?>

This setup ensures that WordPress correctly loads from a subdirectory while keeping the site accessible from the root domain.