• Resolved Nykle

    (@nykle)


    Hello!
    I’ve installed the All In One WP Security & Firewall plug-in (version 4.0.1) and I’m running into some errors. I get the following errors when I try to apply the blacklist settings:

    [10/14/2015 2:41 PM] – FAILURE : Unable to write to .htaccess – server type not supported!
    [10/14/2015 2:41 PM] – SUCCESS : AIOWPSecurity_Blacklist_Menu – The plugin was unable to write to the .htaccess file.

    The server is running PHP Version 7.0.0RC1, Microsoft-IIS/8.5 and Helicon Ape to handle the .htaccess files. AFAIK the .htaccess file has read and write access.
    Is there anything I can do to solve this issue?
    Kind regards

    https://wordpress.org/plugins/all-in-one-wp-security-and-firewall/

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Contributor mbrsolution

    (@mbrsolution)

    Hi please speak to your host about this issue. They should be able to pin point how to implement .htaccess writing files in your IIS sever.

    Hello,

    IIS web hoster here 🙂

    in /classes/wp-security-utility.php on line 480 you declare the following function:

    static function get_server_type()

    which you use to perform a check to get the server type used by the plugin’s user. A few servertypes will get an ‘OK’ for the rest of the plugin, while all others are denied with an error. For this I feel it might be better to use the two variables from WP: $is_iis7 and $is_apache.

    While some IIS setups do allow the usage of Apache styled .htaccess configuration-files, not all setups support this.

    In this specific case you can add the following lines to this file, on lines 495 through 499:

    else if
    (strstr(strtolower(filter_var($_SERVER['SERVER_SOFTWARE'],
    FILTER_SANITIZE_STRING)), 'iis'))
            {
                return 'iis';
            }

    This will fix the plugin for IIS users that have the ability to use .htaccess files. For IIS users that have to use web.config files you can take the following steps:

    1. Check whether the IIS rewrite module is active (iis7_supports_permalinks()) https://developer.wordpress.org/reference/functions/iis7_supports_permalinks/
    2. Add the required rules to the web.config configuration of the site: iis7_add_rewrite_rule() https://developer.wordpress.org/reference/functions/iis7_add_rewrite_rule/

    This way this plugin should work on most IIS servers.

    Kind regards,

    Pieter

    Plugin Contributor mbrsolution

    (@mbrsolution)

    @pieter, thank you for your fantastic information. I am sure the plugin developers will investigate further your great solution.

    Have a great day.

    Regards

    I actually just tried the above, and on the install I tried it on the security utility already had the get server type line so that was not needed.

    I added the other line shown on about line 496 I think, and after restarting the site and recycling the application pool it did allow the writing to the htaccess.

    The problem is when using helicon to handle the htaccess use, the rules that the plugin writes I do not think are correct syntax.

    To test this I added the ip of one of my servers to the blacklist manager and saved it. I viewed the htaccess and the ip was in there but was still able to browse the test site after adding the block rule.

    I do in fact still like the plugin and have found some of the functions quite handy on a number of sites, but wish the blacklist part worked out better on IIS.

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Unable to write to .htaccess’ is closed to new replies.