.htaccess Generation Issues in wordpress

Fixing .htaccess Generation Issues in wordpress

If your installation of WordPress does not generate a .htaccess file or if it does not write the new rules onto your existing .htaccess file then there are a couple reasons that could be causing this. Work step by step and continue to the next step only if the previous step does not work.

  1. Change File Permissions: You must chmod the .htaccess file to 666 to edit it with the WordPress template editor, but this is not recommended, since if you do that, any user of your blog, who can edit templates will be able to edit it. You can change the permissions to 660 to make it server-writable, which again will have the same limitation.

  2. Server Blockage: Your host might have blocked the SERVER_SOFTWARE variable and this will cause WordPress’ .htaccess generation to fail. If you are sure that your server is running Apache, you can force WordPress to believe that your server is running Apache by changing your wp-includes/vars.php file. Follow the steps below to implement these changes.

    • Open the wp-includes/vars.php file using the built in file editor in your WordPress Admin panel. To navigate to this panel, login to WordPress, click on “Manage”, then on “Files”, scroll to the bottom and type in wp-includes/vars.php into the text box under the “Other Files” title. Look for

      $is_apache = strstr($_SERVER[‘SERVER_SOFTWARE’], ‘Apache’) ? 1 : 0;

      and replace it with

      // $is_apache = strstr($_SERVER[‘SERVER_SOFTWARE’], ‘Apache’) ? 1 : 0;

    • Add a new line under

      // $is_apache = strstr($_SERVER[‘SERVER_SOFTWARE’], ‘Apache’) ? 1 : 0;

      and type in

      $is_apache = 1;

    Done