(please specify the URL of the site on which you are experiencing the problem)
.htacess file keeps changing after I edit it or replace it
(please share the FULL error message you see, if applicable)
Other Information
.htacess file keeps changing after I edit it or replace it- I am trying to force all requests to use https://
After I edit or replace, it works, then your system replaces it, back to square one. Fix please.
I can upload no problem, the issue is this file gets overwritten by the system. If you look in these files it warns you it will be overwritten. I need to know how to stop this happening.
This is because you have turned on Directory Protection/Protected Directories. Turn it off in the client area or put your custom .htaccess statements after the END InfinityFree Directory Protection line.
If it is a problem with our system, I want to fix it. But right now I’m not sure exactly what happens.
Can you give me steps on how I can reproduce this issue myself? What content should be added where and what and when does it change to when it “replaces it back to square one”?
htacess file gets over written after edited, see below…
before:-
# BEGIN InfinityFree Directory Protection
# DO NOT EDIT - YOUR CHANGES WILL BE OVERWRITTEN
AuthType Basic
AuthName "Login Required"
AuthUserFile "/home/vol4_4/infinityfree.com/if0_36269734/htdocs/Library/.htpasswd"
Require valid-user
# END InfinityFree Directory Protection
php_value display_errors On
php_value date.timezone Australia/Adelaide
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:CF-Visitor} !{"scheme":"https"}
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
After:-
# BEGIN InfinityFree Directory Protection
# DO NOT EDIT - YOUR CHANGES WILL BE OVERWRITTEN
AuthType Basic
AuthName "Login Required"
AuthUserFile "/home/vol4_4/infinityfree.com/if0_36269734/htdocs/Library/.htpasswd"
Require valid-user
# END InfinityFree Directory Protection
php_value display_errors On
php_value date.timezone Australia/Adelaide
Can you also say when this content changes? Does this happen immediately when you save the file (you save it, you open it again, and it’s like this)? Or do you do something else that triggers this rewrite?
My hunch is that there might be an error with the PHP Options menu in the client area that incorrectly updates your .htaccess file. But that rewriting only runs when you save the options in the client area. If this happens even if you don’t touch that menu, then it must be something else.
I did notice that the part that says DO NOT EDIT, you made some changes, because you moved the .htpasswd file. Please be careful with changes like that, they may get overridden.