Skip to content
BeoHosting
BeoHosting

Free tool for web administrators

.htaccess Generator — Online Apache Configuration

Generate an Apache .htaccess file without knowing the syntax: redirects, force HTTPS, www/non-www, IP blocking, GZIP, browser cache, custom error pages, hotlink protection.

QUICK ANSWER

How to create an .htaccess file without knowing the syntax?

.htaccess Generator creates a ready Apache .htaccess file in 3 steps: 1) Check the functions you need (force HTTPS, www/non-www redirect, GZIP, cache, hotlink protection, custom 404/500 pages). 2) Add 301/302 redirects (old → new path) and blocked IP addresses. 3) Click Copy and paste into the .htaccess file in cPanel File Manager or via FTP. All generated code is standard Apache 2.4+ that works on all shared hosting plans.

  • 8 functions — HTTPS, www, redirect, IP block, cache, GZIP, error, hotlink
  • No syntax needed — just check and copy
  • Apache 2.4+ compatible — works on all cPanel hosting
  • Generated locally in the browser — without sending to the server

BeoHosting Team

10+ years of experience — Web hosting and infrastructure specialists

Last updated:

.htaccess Generator

Check functions, add redirects and blocked IPs — generate .htaccess content with one click.

301 / 302 Redirects

Add redirects from old to new path.

IP address blocking

List of IP addresses denied access to the site.

Custom error pages

Nice 404/500 pages instead of Apache defaults.

Generated .htaccess content

# .htaccess generated by BeoHosting .htaccess Generator tool
# https://beohosting.com/alati/htaccess-generator
110 characters2 lines

Note: Before applying .htaccess, always make a backup. Syntax errors can break access to the site (500 error). Test from an Incognito window.

Guide

.htaccess file — what it is and what it can do?

.htaccess (Hypertext Access) is a configuration file for the Apache web server that is placed in the directory where you want its rules to apply. Although Apache is most powerful when configured via the main httpd.conf file, on shared hosting you do not have root access — so .htaccess gives you almost the same configuration possibility at the directory level.

Most common .htaccess functions

Typical uses: 1) URL redirect (301 for permanent, 302 for temporary), 2) Force HTTPS redirection, 3) www/non-www redirection, 4) Blocking IP addresses or user agents, 5) Custom 404/500 pages, 6) Browser cache headers (reduce server load), 7) GZIP compression (reduces HTTP response size by 70-80%), 8) Image hotlink protection (prevents bandwidth theft). All of this works on every shared cPanel hosting.

Tips for working with the .htaccess file

1) Always make a backup before changes — syntax errors can block the entire site with a 500 Internal Server Error. 2) Comments start with # for organization. 3) The change is applied instantly — no server restart needed. 4) For WordPress sites, .htaccess is generated automatically by WordPress — do not delete the WordPress section. 5) If you are hosting on a LiteSpeed server (BeoHosting), most .htaccess directives work identically — LiteSpeed is Apache-compatible.

Ready to launch your website?

SSL protection
Speed
24/7 support

Join 4,000+ satisfied customers. Free migration and 15-day money-back guarantee.

15-day money-back guarantee
Free migration15-day guarantee24/7 support

Frequently asked questions - .htaccess Generator

Answers to the most common questions about our services.

The .htaccess file goes into the site's root directory (public_html or www folder). The rules from .htaccess apply to that folder and all subfolders. You can also have a subfolder .htaccess file that overrides parent rules. On cPanel hosting: File Manager → public_html → Settings → check „Show Hidden Files (dotfiles)“ → New File → .htaccess.

1) Open File Manager in cPanel, 2) Find the .htaccess file, 3) Rename to .htaccess.bak (temporarily), 4) The site will work (Apache will ignore .htaccess). 5) Open .htaccess.bak in an editor, find the syntax error, fix it and rename back to .htaccess. Most common errors: typos in directives, a mod that is not loaded on the server (e.g. mod_rewrite).

Yes! LiteSpeed is 100% Apache-compatible and reads .htaccess files with the same syntax. All BeoHosting plans use LiteSpeed Enterprise which executes .htaccess rules faster than standard Apache thanks to built-in caching. Your existing .htaccess from another host will work without changes.

301 = permanent redirect. The browser and Google cache it and 'remember' that the URL has been permanently moved. Used for rebranding, moving pages, SSL migration. 302 = temporary redirect. Not cached. Used for A/B tests, temporary page maintenance, geo-redirects. For SEO always use 301 unless you need a strictly temporary redirect.

Yes, use CIDR notation: Require not ip 192.168.1.0/24 blocks all IPs from 192.168.1.0 to 192.168.1.255. For blocking a whole country we recommend a GeoIP plugin or Cloudflare Firewall — .htaccess with hundreds of IP ranges slows down the server. Our generator is for blocking individual IPs (up to 20-30 addresses).

Our guarantees for your peace of mind

Protected from every angle

15-day guarantee

We refund without questions in the first 15 days.

Free migration

We migrate your site with no downtime — you do nothing.

24/7 support

Our experts are here 24/7 via tickets and live chat.