Flash Sale:75% Off Hosting + Free DomainEnds in13h47m14sView Plans
Hostvento logoHostvento

How to Edit the .htaccess File in cPanel File Manager

This guide shows you how to open and change your .htaccess file safely, using only your browser.

Files and FTP2 min read15 steps15 screenshots

What is .htaccess?

A .htaccess file is a small settings file for your website. It gives the web server simple rules. The web server is the program that sends your pages to visitors. With .htaccess you can send visitors from one page to another (a redirect), block some visitors, or set up nice page links.

The file name starts with a dot. On Linux, that makes it a hidden file. Hidden files do not show up until you ask to see them.

Warning: One wrong character can make your whole website show an error. Always make a copy of the file before you change it.

Steps

  1. Log in to cPanel. Your welcome email from Hostvento has the details.
  2. Under Files, click File Manager.
    Screenshot: Under Files , click File Manager .
    Screenshot: Under Files , click File Manager .
    Screenshot: Under Files , click File Manager .
    Screenshot: Under Files , click File Manager .
  3. Click Settings in the top right corner.
  4. Tick Show Hidden Files (dotfiles).
    Screenshot: Tick Show Hidden Files (dotfiles) .
  5. Click Save.
  6. Open the public_html folder. This is where your main website lives.
  7. Find the file named .htaccess. If you cannot see it, your site may not have one yet.
    Screenshot: Find the file named .htaccess . If you cannot see it, your site may not have one yet.
    Screenshot: Find the file named .htaccess . If you cannot see it, your site may not have one yet.

Make a backup copy first

  1. Right-click .htaccess and choose Copy.
  2. Type a new name like /public_html/.htaccess-backup.
  3. Click Copy File(s).
    Screenshot: Click Copy File(s) .
    Screenshot: Click Copy File(s) .
    Screenshot: Click Copy File(s) .
    Screenshot: Click Copy File(s) .

If something breaks later, you can delete the broken file and rename the backup back to .htaccess.

Edit the file

  1. Right-click .htaccess and choose Edit.
    Screenshot: Right-click .htaccess and choose Edit .
  2. A small notice may ask about encoding. Click Edit to continue.
    Screenshot: A small notice may ask about encoding. Click Edit to continue.
  3. A text editor opens. Add or change your rule. For example, this rule sends all visitors from http to https:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]

This tells the server: if the visit is not secure, send the visitor to the secure version of the same page.

  1. Click Save Changes in the top right.
  2. Open your website in a new browser tab and check it still works.

If your site shows an error

You might see "500 Internal Server Error". This usually means a rule has a typo. Open the file again and remove your last change. Or restore the backup copy you made.

Tip: Add only one change at a time. Test after each change. Then you know exactly which rule caused a problem.

Need help? Open a support ticket.

Quick recap

  • .htaccess is a hidden settings file for your website.
  • Turn on Show Hidden Files in File Manager settings.
  • Copy the file as a backup before editing.
  • Right-click, choose Edit, then Save Changes.
    Screenshot: Right-click, choose Edit , then Save Changes .
    Screenshot: Right-click, choose Edit , then Save Changes .
  • Test your site right away.