• Resolved GermanKiwi

    (@germankiwi)


    Hi Mark, thanks for all the time you’re putting in to help us out with the questions and issues we have – a big update like this naturally results in a lot of questions. I’ve enabled Falcon on one of my (fairly vanilla) sites and found a big improvement in site speed.

    I’m having some trouble on my other site, though, getting Falcon to work. I’ve encountered two issues which may or may not be related. This site uses a subdirectory installation (WordPress is installed at http://www.example.com/wordpress) but my .htaccess file is located in the root directory (www.example.com), which is where WordPress itself writes its permalink rules to. However, as far as I can tell, Wordfence wants to write its own Falcon rules to the .htaccess file in the /wordpress subdirectory, which is the correct (or at least not the ideal) place – in my case, I don’t even have a .htaccess file there at all, as I deleted it due to it being unused/unnecessary.

    I’ve gone into this issue in more detail in the comment I made on your blog post here – you may have already read it – I won’t repeat those reasons here, but simply ask if you could kindly modify Wordfence so that it writes its rules to the same .htaccess file that WordPress itself uses for its permalink settings – namely the copy in the root directory.

    BTW I noticed in the Wordfence 5.0.2 changelog you have this entry: “Fix: Issue that caused caching to not work on sites using subdirectories.” I thought that might be related, but it doesn’ seem to have fixed this for me. I’m not sure what, specifically, this changelog entry refers to though – perhaps you could elaborate?

    The second issue I’ve encountered is this:

    I wanted to at least see if I could at least get Wordfence to write its rules to the .htaccess file in the /wordfence subdirectory – I currently didn’t have any .htaccess file there, so I created a new, completely empty one in that location and gave it the necessary write permissions. Then I tried to enable Falcon. I got this error after I clicked the “Enable Falcon Engine” button:

    Wordfence could not edit your .htaccess code. The error was: Could not read from /path/to/my/public_html/wordpress//.htaccess

    I’ve munged the path, obviously. But note the double-slash there before “.htaccess” – that double-slash was given in the error message. Could that be the cause of this not working? Otherwise I have no idea why Wordfence can’t write to that empty .htaccess file, which does now exist at that location.

    Thanks for your assistance!

    https://wordpress.org/plugins/wordfence/

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Mark Maunder

    (@mmaunder)

    Hi,

    The second issue is that your .htaccess permissions are set so that your web server doesn’t have permissions to modify it. You need to change this is you want wordfence to update it.

    The first issue we’re aware of – where you have a subdir site but a root .htaccess and we will fix this in the next release.

    Regards,

    Mark.

    Thread Starter GermanKiwi

    (@germankiwi)

    Thanks Mark – I’m glad you’ll be fixing the root .htaccess issue in a future release, I appreciate that!

    Regarding the second issue – I just changed the permissions of that .htaccess file (in my WP subdir) to 777 – full permissions – and I still got the exact same error from Wordfence.

    I’m still wondering if that double-slash in the path is related? If not, then something else is not working here.

    For what it’s worth, the .htaccess file in my *root* directory, which WordPress itself successfully writes to with its permalink settings, only needs permissions of 740 to allow WordPress to write to it on my web server (my web server is configured a little differently than is typical, with regards to users and permissions). My point being that 740 should be sufficient (in fact I think 640 is sufficient) – yet even when I set the subdir .htaccess file to 777 it still doesn’t work with Wordfence. That suggests the issue isn’t permissions.

    Any ideas?

    Plugin Author Mark Maunder

    (@mmaunder)

    Could it be that we’re simply not finding the .htaccess because of the existing subdirectory bug?

    Regards,

    Mark.

    Thread Starter GermanKiwi

    (@germankiwi)

    I don’t think so. For the purpose of testing this, I specifically created a new .htaccess file there in the subdirectory. If Wordfence is trying to write to the file there, it should be able to do so.

    One of the other commenters on your blog post (here) mentioned that he’s using a subdir installation of WP (like me) and had no problem enabling Falcon. Most likely that’s because he *copied* the original .htaccess file from the subdirectory to the root directory (which is what the codex instructs for such a scenario) – meaning that the original, empty .htaccess file remains in his subdirectory where WP is installed – and Wordfence is writing the Falcon rules there.

    But that’s exactly the situation that I have recreated now. I’ve re-created the empty .htaccess file in the subdirectory. So I don’t know why Wordfence is unable to write to it.

    Is there any kind of logging or debugging I can enable that will help test it?

    Or should we just ignore this for now as you’re going to be updating Wordfence anyway, to support the subdirectory setup, which would make this a non-issue for me?

    Thread Starter GermanKiwi

    (@germankiwi)

    Just upgraded to 5.0.4, and I’m happy to report that Falcon works just fine with my setup now! It correctly write its rules to the .htaccess file in my root directory, and seems to be performing well. 🙂

    So for me, that makes the other issue about why it was unable to write to the .htaccess file in my subdirectory, a moot point.

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Wordfence could not edit your .htaccess code’ is closed to new replies.