The file name starts with a dot, so Linux and file managers hide it by default. On every request the server looks for .htaccess files in the requested folder and the folders above it and applies what they say. Changes take effect immediately with no server restart, which is exactly why it matters on shared hosting, where customers can’t reach the main server configuration.
Common uses with examples
Force HTTPS across the whole site:
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
A 301 redirect from an old page to a new one:
Redirect 301 /old-page/ https://example.com/new-page/
Turn off directory listings, protect a sensitive file and set a custom error page:
Options -Indexes
<Files ".env">
Require all denied
</Files>
ErrorDocument 404 /404.html
Common mistakes
- A 500 error right after editing: one invalid or unsupported line takes the whole site down. See HTTP 500 explained.
- Redirect loops: two rules redirect to each other, or HTTPS is forced behind Cloudflare’s Flexible mode, giving ERR_TOO_MANY_REDIRECTS.
- The file does nothing: Nginx never reads
.htaccess; its rules go in the main server configuration. - Rules disappearing in WordPress: WordPress writes its permalink rules between
# BEGIN WordPressand# END WordPress. Put your own rules outside that block so they aren’t overwritten. - Rule order: rules run top to bottom, so place redirects above the WordPress block.
On ArabyHost
ArabyHost runs the LiteSpeed web server, which understands Apache syntax and reads .htaccess files directly, so the usual WordPress and Laravel rules work unchanged. You’ll find the file in public_html in the cPanel File Manager once hidden files are shown. The LiteSpeed Cache plugin adds its own rules to the file too, so leave them in place. Use the htaccess redirect generator to build correct redirects, and the force HTTPS guide once your free SSL certificate is issued.
FAQ
Why can't I see .htaccess in the File Manager?
Its name starts with a dot, so it's treated as hidden. Turn on "show hidden files" in the File Manager settings; if it still isn't there, you can create it in `public_html`.
I got a 500 error after editing it. What now?
Undo your last change or temporarily rename the file to `.htaccess.bak`. If the site comes back, one of the lines you added is the problem, and the error log will say which.
Does .htaccess slow a site down?
A normal file has a negligible effect. Hundreds of duplicated or overlapping rules do slow down every request, so remove what you don't need.