What is .htaccess?
The .htaccess is an extremely powerful configuration file for your web server. With just a few lines of code, you can control your website's behavior – from automatic redirects to security measures.
Step 1: Finding the file in the File Manager
Files that start with a dot (like .htaccess) are treated as "hidden" by the system. Here is how to make them visible:
- Open the File Manager in cPanel.
- Click on Settings in the top right corner.
- Check the box "Show Hidden Files (dotfiles)".
- Click Save. The file will now appear in the
public_htmlfolder.
Practical Code Snippets
Simply copy these templates to the beginning of your .htaccess file:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Ideal for manually excluding annoying attackers or bots:
Order Allow,Deny
Deny from 123.456.78.9
Allow from all
Prevents visitors from seeing a file list if no index.php is present:
Options -Indexes
Is your website showing an error after the change?
Don't panic! Simply delete the last change or upload your backup. If you have any questions, CURIAWEB Support is here to help!