.htacess file overwritten

3tteam.com

(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.

Can you share a screenshot of the file manager. Where the .htaccess file exists.

2 Likes

have you tried uploading it through a local ftp client like filezilla?

3 Likes

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.

looks like you are uploading it to the wrong location. make sure you upload it to the assigned htdocs folder for your domain

3 Likes

If uploading to the wrong area, why is it working? Of course it is in htdocs directory.

Read this file - .htacess

# BEGIN InfinityFree Directory Protection
**DO NOT EDIT - YOUR CHANGES WILL BE OVERWRITTEN
**AuthT**ype 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]

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.

3 Likes

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”?

2 Likes

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

OK, so it’s clear how the content is changed.

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.

2 Likes

It takes a while to change, just looked at it and so far has not changed. Will check again tomorrow and see.

Well, for some reason it still has not changed, file date is still 25th… So, all good.

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.