• Resolved aberkow

    (@aberkow)


    Hello,

    I’ve got an issue where W3TC refuses to recognize either the location of my .htaccess file or changes I make to the file it thinks it should use.

    The location of my .htaccess file is at /var/www/sites/com.mysite/public_html/.htaccess. That directory has permissions of 755 and the .htaccess file has a permission of 674. However, in the admin area of my site, W3TC insists that the .htaccess file be created at /var/www/sites/com.mysite/public_html/wordpress/.htaccess. Is it possible to change this?

    I ask, because even if I manually create a .htaccess file at the location W3TC expects and add the rules W3TC wants, it still throws errors at me.

    Thanks very much for any help you can provide.

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @aberkow

    Thank you for reaching out and I am happy to assist you with this.
    The W3 Total Cache is using the .htaccess file in the root of the website where the plugin is installed.
    This .htaccess file should be among the other WP files like wp-config.php and also the wp-content folder wp-includes and wp-admin.
    Can you please share which folder is the root of your website and does that .htaccess contain any W3TC rules?

    Thanks!

    Thread Starter aberkow

    (@aberkow)

    Hi @vmarko,

    Thanks for getting back to me so quickly.

    Here’s a sketch of our filesystem. The main things to note are that we have a custom wp-config.php file which is outside the /wordpress directory. This allows us to customize our config and push WP core changes without having to manage additional files.

    
    /public_html
    |_ /content
    |_ env-config.php
    |_ .htaccess (I'd like to use this one and have W3TC ignore the other or recognize this one)
    |_ index.php
    |_ /wordpress
    |_ wp-config.php (loads config files from /wp-env)
    |_ /wp-env
    

    With this set up, we can easily manage core updates separately from our config files using jenkins to push changes.

    However, even when I manually added a .htaccess file with rules at /wordpress/.htaccess, it isn’t recognized.

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @aberkow

    Thank you for your feedback.
    Well, it’s a strange configuration. The W3TC uses the .htacces in the document root folder. You should try to set permission 644 for this .htaccess file, and let me know the URi.
    Thanks!

    Thread Starter aberkow

    (@aberkow)

    Hi @vmarko,

    Just to clarify, the document root per apache config is /var/www/sites/com.mysite/public_html.

    I set permissions for /public_html/.htaccess and /public_html/wordpress/.htaccess both to 644 with no luck. The error message remains on the admin plugin page.

    Does W3TC require that the .htaccess file (wherever it is) be owned by a certain user or group?

    What I’m struggling to understand is – even if W3TC itself can’t write to the file, why does the error message stay even when I update the file manually?

    Thanks again for your help.

    Thread Starter aberkow

    (@aberkow)

    Oh you know what… the owner/group doesmatter. The error message immediately went away after I did the following

    
    cd /{the right directory}/wordpress
    sudo chown apache:apache .htaccess
    

    I think we might be able to close this ticket, but can you help me understand this a little better?

    Plugin Contributor Marko Vasiljevic

    (@vmarko)

    Hello @aberkow

    Thank you for your feedback.
    It looks like it was an ownership permission issue. The web server must be running as apache and couldn’t read the file when it was owned as another user with lesser permissions for the world. Another issue could have been the location; the file needs to be in the virtual host document root or in its subdirectories.

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘W3TC uses wrong .htaccess file location and doesn’t recognize manual changes’ is closed to new replies.