skip to Main Content

I have a website created with HTML, CSS, and JavaScript. I am trying to accomplish a 301 redirect (from http to a https connection) using my .htaccess file through filezilla.
When trying to View/Edit the .htaccess file, I have a “transfer error”. Which doesn’t let me view/download/edit the file.

when I tried finding solutions I saw people used their cPanel to edit the file instead. I have my hosting with Blacknight, and in my file manager there is no .htaccess file.
I thought there was something wrong in the way i had made the file visible in FileZilla but that wasn’t the case either.
I have also tried changing the file permissions to 755 but they’re reverted back to their own settings of 440 whenever I open them again.

Note: Where I can see my .htaccess file in Filezilla, is on the right hand side of the Filezilla program where remote site is, and the second box down where there are other files such as error_docs, siteapps etc.

I need the .htaccess to open so I can paste in the code below which would then do the redirect from http to https.

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

The .htacces file should open when i click on it, or when I right click and then click View/Edit.
All it does now is say “transfer failed” and “critical file transfer error”.
Thanks for any help :]

2

Answers


  1. Chosen as BEST ANSWER

    The solution to this was to create a new .htaccess in Blacknight Control Panel File Manager. I had already tried to show hidden files but the reason it wasn't showing was because for some reason it didn't exist in the file manager, when it did in my Filezilla.

    What I had to do was: -Open the file manager -right click and select create new text file -right click and select edit -paste in the redirect code -save file -rename text file to .htaccess and remove the .txt extension NOTE: Only remove the .txt extension after you have edited the file, as doing beforehand will not allow you to edit the file.


  2. It looks like the FTP username which you are using does not have the privilege to edit the files.

    You can use the cPanel –> File Manager to edit the files. You have mentioned that you are not able to see the .htaccess file when you do this. This could be because .htaccess is a hidden file and will not show on File Manager by default.

    To see hidden files select File Manager. Click the top-right Settings button. Then on the Preferences window, check the option Show Hidden Files (dotfiles). Confirm the action by clicking the Save button.

    After this you should be able to view and edit the .htaccess files. Please note that generally .htaccess file is in the public_html directory.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search