Error during FTP upload, permission denied at:"/.htaccess"

Hello I am getting this error while editing /.htaccess. My goal is to redirect http to https. Can you help me solve the problem? thank you…

You cannot edit this .htaccess file, instead you must create a new one inside htdocs.

5 Likes

thank you

1 Like

Inside the “htdocs” directory create a file called .htaccess and write the following:

RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} =http
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

You can also make your website redirect to a custom 404 page, 505… etc:

ErrorDocument 400 https://example.com/error/400
ErrorDocument 401 https://example.com/error/401
ErrorDocument 403 https://example.com/error/403
ErrorDocument 404 https://example.com/error/404
ErrorDocument 503 https://example.com/error/503

I leave you a guide in case you are interested in some more options :slight_smile:

3 Likes

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