• Resolved Paul Biron

    (@pbiron)


    I just started evaluating w3tc and came across and issue with keeping .htaccess in version control on my local dev machine.

    On my local machine (WP 4.9.6, win10 pro, apache 2.4, site config’d as a VHost), w3tc adds the following to .htaccess:

        RewriteCond "%{DOCUMENT_ROOT}%C:/full/windows/path/to/site/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index%{ENV:W3TC_SSL}%{ENV:W3TC_PREVIEW}.html%{ENV:W3TC_ENC}" -f
        RewriteRule .* "C:/full/windows/path/to/site/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index%{ENV:W3TC_SSL}%{ENV:W3TC_PREVIEW}.html%{ENV:W3TC_ENC}" [L]
    

    whereas, on the server of the I’m testing it on (WP 4.9.6, centOS, apache 2.4), I get:

    
        RewriteCond "%{DOCUMENT_ROOT}/wp-content/cache/page_enhanced/ ... -f
        RewriteRule .* "/wp-content/cache/page_enhanced/%{HTTP_HOST}/%{REQUEST_URI}/_index%{ENV:W3TC_SSL}%{ENV:W3TC_PREVIEW}.html%{ENV:W3TC_ENC}" [L]
    

    How can I get the install on my local machine to not include the full windows path to the site in the Rewrite{Cond,Rule}? I ask because this difference means that I can’t keep the .htaccess in version control.

Viewing 5 replies - 1 through 5 (of 5 total)
  • Thread Starter Paul Biron

    (@pbiron)

    Forgot to mention: w3tc 0.9.7.

    Let me know if there is any other info you need to help figure this out.

    Plugin Contributor gidomanders

    (@gidomanders)

    Short answer, we do not fully support windows systems.

    Long story, the code building the htaccess file could be patched to support the windows file system, but that results in bugs somewhere else. Every time we change code to support windows, something else breaks. This all has to do with the core of the plugin which was originally built with a different purpose.

    Conclusion, for now you can keep the version built by your Linux system in version control, which works on windows systems too as far as I know. You just don’t save the settings, or overwrite the file with a save from your Linux system before committing it.

    If you have any questions, please let me know!

    Thread Starter Paul Biron

    (@pbiron)

    Conclusion, for now you can keep the version built by your Linux system in version control, which works on windows systems too as far as I know.

    yes, as far as I can tell, the rules built on the linux host do work on my windows box.

    You just don’t save the settings, or overwrite the file with a save from your Linux system before committing it.

    Did you mean to say “overwrite with a save from you Windows system before committing it”? If so, then yes, I guess I could VC the linux built .htaccess and just never change any settings on my windows box.

    I do have a dev version of the site on the linux host, but it is far easier to experiment with how changes to a given setting effect what w3tc does on my windows box.

    Are there specific setting(s) that control the output of those 2 lines in .htaccess? Or is it the simple act of clicking “Save Settings”? If it’s specific setting(s), then I can just make sure I don’t change that setting(s) will being free to experiment with other settings on the windows box.

    Plugin Contributor gidomanders

    (@gidomanders)

    That is correct.

    And there is no setting for it. Every time you click save settings, the htaccess rules are verified and changed if necessary. So unfortunately you cannot change settings without overwriting the file ??

    Thread Starter Paul Biron

    (@pbiron)

    OK. I’ll experiment more and see if I can figure out a workable strategy for myself. Thanx for you quick replies!

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘.htaccess RewriteRule version control issue’ is closed to new replies.