Which .htaccess rules work on your hosting
On this page
Websites here are served by OpenLiteSpeed, a fast web server that reads .htaccess files like Apache does for the rules most sites use: URL rewriting (WordPress, Laravel and shop permalinks), blocking access to files and folders, and PHP settings. Some other Apache directives are not applied.
.htaccess files are not read at all, and the MIME Types & Handlers page says so.What works
| In .htaccess | What happens |
|---|---|
RewriteEngine, RewriteCond, RewriteRule | Applied, like Apache mod_rewrite. Redirects with [R=301] work. |
Deny from all, Require all denied | The folder (or the files in a <Files> / <FilesMatch> block) is blocked with 403. |
Allow from 203.0.113.10, Require ip 203.0.113.0/24 | Exceptions: these addresses still get through. |
<Files> and <FilesMatch> with the lines above | Applied to the matching file names. |
<IfModule mod_rewrite.c> and <IfModule mod_php…> | Read through. |
php_value / php_flag in the .htaccess at the top of a website's folder | Applied as the website's PHP settings (see below). |
PHP settings accepted from .htaccess: memory_limit, upload_max_filesize, post_max_size, max_execution_time, max_input_time, max_input_vars, max_file_uploads, display_errors, date.timezone, output_buffering, short_open_tag, session.gc_maxlifetime, default_charset, zlib.output_compression, mbstring.internal_encoding and allow_url_fopen. Other settings, such as auto_prepend_file, are ignored. Values set on the PHP page take priority over .htaccess.
What does not work, and what to use instead
- Password protection (
AuthType,AuthUserFile,Require valid-user) — use Access Control (section Domains) to password-protect a folder. ErrorDocument— set your own 403, 404, 500 and 503 pages under Redirects (section Domains).AddTypeandAddHandler— use MIME Types & Handlers.Options +Indexes— directory listing is off by default; turn it on per folder in Access Control.- Access lines with conditions that cannot be translated exactly (for example
<Limit>,<If>,Satisfy any, address ranges other than /8, /16, /24 or /32) are skipped rather than guessed. Rewrite rules in the same file still work.
How fast changes apply
The server checks for new or changed .htaccess files every minute and reloads gracefully, without dropping visitors. A change you save is live within about a minute. Deleting a .htaccess file also removes its rules within a minute.
Good to know
- Access rules are read from
.htaccessfiles up to 8 folders deep and smaller than 64 KB. - A website with a certificate is always redirected from
http://tohttps://by the server; you do not need your own rule for that. - A broken rewrite rule can cause a 500 error or a redirect loop. Rename the file to
.htaccess-offin the File Manager to test without it.
Common questions
WordPress permalinks give 404 errors. What can I do?
Check that the website's folder has WordPress's .htaccess with its RewriteRule lines. In WordPress, open Settings → Permalinks and click Save to write it again, then wait a minute.
My "Deny from all" does not block anything. Why?
Wait a minute after saving. If it still works, check that the file has no Require line with other conditions (such as Require valid-user) — such files are left alone so that their owner is not locked out.
Thank you — this helps us improve the article.
Still stuck?
Ask the AI about your exact situation — it answers from this knowledge base — or contact us.
Related articles
- How to edit a file online in the File Manager
Open a text file such as .htaccess, wp-config.php or index.html in the File Manager's editor, change it and save it, with the limits that apply.
- How to change PHP settings like memory_limit and upload size
Raise memory_limit, upload_max_filesize, post_max_size, max_execution_time or max_input_vars in the PHP page, with allowed ranges and ready-made presets.
- How to add MIME types and run .html files as PHP
Add a file type such as .webmanifest, run .html or .htm pages as PHP, and turn on CGI scripts in cgi-bin with MIME Types & Handlers.
- Website not working? Find the cause with Site Check
Website not loading or showing an error? Site Check tests DNS, the server's answer, the SSL certificate, disk and bandwidth limits and PHP errors in one click.