.htaccess basics
What .htaccess is, how to edit it safely and examples of common rules.
.htaccess is a configuration file in the site folder that changes server behaviour for that folder: redirects, protection, caching and the like. Our server uses LiteSpeed, which understands most Apache rules.
How to edit it#
- In File Manager open Settings and enable Show Hidden Files (dotfiles).
- Open the site folder (e.g.
public_html) and find.htaccess. If it does not exist, create it with + File. - Before editing, right-click → Copy and save the copy as
.htaccess-old. - Right-click → Edit, change and save.
- Refresh the site immediately. If an error appears, restore the copy.
Examples#
Redirect an old page to a new one:
apache
Redirect 301 /old-page https://yourdomain.com/new-pageForbid listing a folder's contents:
apache
Options -IndexesA custom page for the 404 error:
apache
ErrorDocument 404 /404.htmlWar dieser Artikel hilfreich?
Danke für Ihr Feedback! Brauchen Sie Hilfe? Eröffnen Sie ein Ticket.
Verwandte Artikel
Redirecting a domain and pagesHow to set up a permanent or temporary redirect to another address in cPanel.Forcing HTTPSHow to automatically redirect all visitors from http:// to https:// using cPanel or the .htaccess file.Error 500 (Internal Server Error)What error 500 means and how to fix it: .htaccess, PHP version, plugins and logs.The public_html folder structureWhat lives in which folder, where your site goes and where addon domains and subdomains go.
