A couple of of my clients are confirming that they're getting "500" Internal Server errors recently. In my opinion it may be triggered by various plug ins they're using but every time, the webhost (multiple hosts) say the htaccess file needed to be changed to repair the problem.

I am posting the code below from the custom theme because it is the only place where I trigger an htaccess write. And That I want to be certain that you will find no problems here that may cause an problem that may lead towards the 500 errors...

if (file_exists(ABSPATH.'/wp-admin/includes/taxonomy.php'))
    {
    require_once(ABSPATH.'/wp-admin/includes/taxonomy.php');
if(get_option('permalink_structure') !== "/%postname%/" || get_option('mycustomtheme_permalinks') !=="/%postname%/")
    {
    $mycustomtheme_permalinks = get_option('mycustomtheme_permalinks');
    require_once(ABSPATH . '/wp-admin/includes/misc.php');
    require_once(ABSPATH . '/wp-admin/includes/file.php');
    global $wp_rewrite;
    $wp_rewrite->set_permalink_structure($mycustomtheme_permalinks);
    $wp_rewrite->flush_rules();
    }
    if(!get_cat_ID('topMenu')){wp_create_category('topMenu');}
    if(!get_cat_ID('hidden')){wp_create_category('hidden');}        
    if(!get_cat_ID('noads')){wp_create_category('noads');}
    }
if (!is_dir(ABSPATH.'wp-content/uploads')) {
    mkdir(ABSPATH.'wp-content/uploads');
}

The code first inspections to make certain taxonomy.php exists, because the wordpress_create_category calls want it. Additionally, it inspections the present permalink configurations and when they aren't set based on my anticipated parameters, I execute the permalink rewrite code the thing is there. Its this code that, I am fairly certain, produces an htaccess edit. I would like to be certain that this can be a seem little bit of programming and never prone to cause sporadic internal server errors...

EDIT: In A Single Situation, the consumer has got the following plug ins in most his sites...

  • AIO Search engine optimization
  • cbnet ping optimizer
  • contact page 7
  • easy online privacy policy
  • Professional-PHP
  • No Cost Traffic Getting Search engine optimization Wordpress plugin
  • google sitemap generator
  • pretty link
  • ReviewAZON
  • Interpersonal
  • StatPress ReLoaded
  • Website Traffic Genius Professional
  • Wordpress DB Backup

The mkdir call will certainly fail if wordpress-submissions are not writable, you have to the permalink edit - if .htaccess isn't writable it will fail and can result in a 500 error (for the way Wordpress implements this). Another possible problem might be that the .htaccess changes corrupt another establishing .htaccess that's required by among the other plug ins.

Regardless : searching in the Apache error log and logging PHP errors ought to be enough to obtain the actual supply of the issue.