Redirect from http to https

Hi
I was trying to redirect from http to https.
I opened the .htaccess file.
"Rewrite Engine On
RewriteCond% {HTTP: X-Forwarded-Proto} = http
RewriteRule (. *) Https: //% {HTTP_HOST}% {REQUEST_URI} [L, R = 301] "
I typed this code and hit the save button but it gave this error.
“eror durg ftp upload, permission denied at” /.htaccess "
Please help me

Put this code in htdocs > .htaccess

4 Likes

I put it and say save but it gives an error

And did you notice the all caps text saying DO NOT EDIT THIS FILE? Because you should not edit that file.

You need to create a new .htaccess file in the htdocs directory and add your code to it.

2 Likes

Also, the code is supposed to be this:

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

If you’re using translation software please ensure it doesn’t translate any code, else disable it momentarily, as a single space or wrong character casing could make the htaccess file not working on this case.

4 Likes

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