I have a htaccess file and the path to access it is:


When I use:

file_put_contents('wordpress/.htaccess', implode('', $data));

I get the error "Failed to open stream"...

How do you target a htaccess file with file_put_contents? From what I can tell the path is correct

  • 3
    What have you tried? 1. How about permissions of that file? 2. Did you tried other paths? Just in case, maybe you're wrong.. Have you tried just /.htaccess or added directory that contains /wordpress/.htaccess? 3. Did you try to echo implode('', $data);? Is everything okay with that? – N00b May 4 '16 at 22:14
  • yea maybe its a permissions issue. Ill check. Thanks for the reminder. – cpcdev May 4 '16 at 22:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.