• Hi,

    I have added (E=HTTP_AUTHORIZATION:%{HTTP:Authorization}) in the .htaccess file under public_html folder in cpanel, but this overrides every day with the default version of the file and remove my added line of http authorization.

    Wondering why this file is updating automatically and reset to the default state? Because when it reset the woocommerce rest API does not work

    Is there a way to stop it update automatically?
    any solution to fix this issue?

Viewing 5 replies - 1 through 5 (of 5 total)
  • I looked at the site mentioned in your profile since you didn’t include a link…

    This is just a guess but there’s an older plugin called ‘WC Fields’ something that is 2 years past its last update and I’m wondering if maybe it might be resetting your htaccess as it might reach that far into the system.

    Maybe disable that plugin…

    And that htaccess line you added… place it outside of the WordPress section of htaccess when you put it back so WordPress should leave it be if it tries to change htaccess due to permalinks and such.

    Else, you might shove that line after changing it as needed into Apache’s config file so nothing tries to rewrite that on the fly.

    Hope something here helps.

    Thread Starter dthsolutionshb

    (@dthsolutionshb)

    Hi Thanks for the reply.

    1, I can not de-acativate that plugin as i need that to be active. any other way?

    2, what do you mean by placing the line outside wordpress? in the .htaccess file it looks like as below. Should i put that line (RewriteRule ^index\.php$ – [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]) after # END wordpress?

    # BEGIN WordPress
    # Direktiven (raderna) mellan BEGIN WordPress och END WordPress genereras dynmiskt och b?r endast ?ndras via WordPress-filter. Eventuella ?ndringar till direktiven mellan dessa mark?rer kommer att skrivas ?ver.
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    # END WordPress

    3, Which Apaches file i can put that line? where can i find that in the cpanel?

    2, what do you mean by placing the line outside wordpress?

    Yes, that is what they meant. So it would look like:

    # END WordPress

    RewriteRule ^index\.php$ – [E=HTTP_AUTHORIZATION:%{HTTP:Authorization},L]

    A better suggestion though is to not to use the E= line at all and change file permissions for .htaccess to 444. If anything trys to make changes in the future they will not be able to–not even you. You would first have to change file permissions back to 644 before any changes could be made.

    Hi. I am really struggling with this issue as everytime wordpress re-writes my htaccess i lose API functionality.
    I have tried moving the authorization line outside of the wordpress block, but it doesnt work.
    Changing the permissions for htaccess is a bad idea as wordpress needs to be ablet to make changes to it.

    For those facing this issues simply create a new .htaccess file and add the following codes, it will prevent further auto modifications of your .htaccess files. for deeper explanation follow the reference stop auto htaccess wordpress modification

    # PREVENT WP AUTO MODS
    # @ https://m0n.co/08
    <IfModule mod_ignore_wordpress.c>
    
    # BEGIN WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
    
    </IfModule>
    • This reply was modified 3 years, 6 months ago by Stanliwise.
    • This reply was modified 3 years, 6 months ago by Stanliwise.
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Why .htaccessfile is updating and reset’ is closed to new replies.