I cannot Edit .htaccess

#608591
  • Resolved Anonymous
    Rank Math free

    I dont know why but my Edit .htaccess

    show this:

    .htaccess file is not writable.

    already try this but not working:

    Access your website files using an FTP client or cPanel File Manager.
    Locate the .htaccess file in the root directory of your WordPress site.
    Right-click on the .htaccess file and choose “File Permissions” or “Change Permissions.”
    Set the file permissions to “644” or “640”. You can usually find this option under “Numeric Value.”
    Make sure to check the “Recurse into subdirectories” box and select the option that says “Apply to files only.”
    Click on the “OK” or “Save” button to save your changes.
    After changing the permissions of the .htaccess file, you should be able to edit it using Rank Math without an

Viewing 3 replies - 1 through 3 (of 3 total)
  • Hello,

    Thank you for contacting Rank Math and sorry for any inconvenience that might have been caused due to that.

    Can you please check if the following line exists in your wp-config.php file? It needs to be set to false so Rank Math can modify your .htaccess and robots.txt files:

    define (‘DISALLOW_FILE_EDIT’, true);
    

    Here is a guide for your reference:
    https://rankmath.com/kb/cant-edit-robots-txt/#robots-txt-file-is-not-writeable

    Let us know how that goes.

    Anonymous
    Rank Math free

    Nevermind I already do its thur SFTP, but what I dont understand here why I keep getting this issue

    “The www and non-www versions of your URL are not redirected to the same site.”

    even after add this on my .htaccess.

    # Force HTTPS
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

    Hi there,

    Thank you for getting back to us. We’re glad to hear that you were able to edit your .htaccess file via SFTP. However, we’re sorry that you’re still facing the issue of www and non-www versions of your URL not being redirected to the same site.

    The code that you added to your .htaccess file is only for forcing HTTPS on your site, which means that it will redirect any HTTP requests to HTTPS. However, this code does not affect the www and non-www versions of your domain. You need to add another code snippet to your .htaccess file to redirect one version to the other.

    There are different ways to do this, depending on which version you want to use as your canonical one (i.e. main URL). For example, if you want to use the non-www version as your canonical one, you can add this code after the HTTPS redirection code:

    
    # Redirect www to non-www
    RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC]
    RewriteRule ^(.*)$ https://%1/$1 [R=301,L]
    

    This code will redirect any requests from www.yourdomain.com to yourdomain.com. Don’t forget to replace yourdomain.com with your actual domain name.

    Alternatively, if you want to use the www version as your canonical one, you can add this code instead:

    
    # Redirect non-www to www
    RewriteCond %{HTTP_HOST} !^www\. [NC]
    RewriteRule ^(.*)$ https://www.%{HTTP_HOST}/$1 [R=301,L]
    

    This code will redirect any requests from yourdomain.com to www.yourdomain.com.

    You can find more examples and explanations of how to redirect www and non-www URLs here: Choosing between www and non-www URLs and How to Redirect WWW Version to Non-WWW Version of Your Website.

    We hope this helps you solve the issue and make your site consistent. If you have any other questions or concerns, please let us know. We’re always here to help you.

    Thank you for using Rank Math!

    Hello,

    Since we did not hear back from you for 15 days, we are assuming that you found the solution. We are closing this support ticket.

    If you still need assistance or any other help, please feel free to open a new support ticket, and we will be more than happy to assist.

    Thank you.

Viewing 3 replies - 1 through 3 (of 3 total)

The ticket ‘I cannot Edit .htaccess’ is closed to new replies.