How to Use .htaccess on Shared Hosting

The .htaccess file is a powerful configuration file used by Apache and LiteSpeed web servers. It lets you control how your website behaves - from setting up redirects and enabling compression to restricting access and customising error pages - all without touching server settings directly.

Where Is the .htaccess File?

Your main .htaccess file lives in your public_html directory. Because it begins with a dot, it's a hidden file, which means it may not be visible in your FTP client unless you enable hidden files.

How to Edit .htaccess in cPanel

  1. Log in to cPanel and open the File Manager.
  2. Navigate to your public_html folder.
  3. Click Settings (top right) and check Show Hidden Files if you don't see the file.
  4. Right-click .htaccess and choose Edit.

Important Tips

  • Always back up your .htaccess file before making changes. A syntax error can make your site inaccessible.
  • Changes take effect immediately - no need to restart anything.
  • You can place a .htaccess file in subdirectories to apply rules only to those directories.
  • WordPress generates and manages its own .htaccess rules automatically - look for the section marked # BEGIN WordPress.

If you accidentally break your site with a bad .htaccess change, deleting or renaming the file will restore access while you troubleshoot. For extra help, contact our support team.

100% Satisfaction Guarantee

We're so confident you'll love dotCanada that we offer a 30-day money-back guarantee. Not satisfied? Get a full refund, no questions asked.

Ready to Get Started?

Join thousands of Canadian website owners who trust dotCanada for reliable, fast web hosting.

Get Started Today