Preskoči na sadržaj
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.

TL;DR

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+ godina iskustva — Stručnjaci za web hosting i infrastrukturu

Poslednje ažurirano:

.htaccess Generator

Cekirajte funkcije, dodajte redirect-e i blokirane IP-ove — generišite .htaccess sadržaj jednim klikom.

301 / 302 Redirect-i

Dodajte preusmeravanja sa stare na novu putanju.

Blokiranje IP adresa

Lista IP adresa kojima se zabranjuje pristup sajtu.

Custom error stranice

Lepe 404/500 stranice umesto Apache default-a.

Generisan .htaccess sadržaj

# .htaccess generisan na BeoHosting .htaccess Generator alatu
# https://beohosting.com/alati/htaccess-generator
111 karaktera2 redova

Napomena: Pre primene .htaccess-a uvek napravite backup. Sintaksne greške mogu da prekinu pristup sajtu (500 error). Testirajte iz Inkognito prozora.

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.

Spremni da pokrenete svoj sajt?

SSL zaštita
Brzina
24/7 podrška

Pridružite se 4.000+ zadovoljnih korisnika. Besplatna migracija i 15 dana garancije povrata novca.

15 dana garancija povrata novca
Besplatna migracija15 dana garancija24/7 podrška

Frequently asked questions - .htaccess Generator

Odgovori na najčešća pitanja o našim uslugama.

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).

Naše garancije za vaš mir

Zaštićeni ste sa svake strane

15 dana garancije

Vraćamo novac bez pitanja u prvih 15 dana.

Besplatna migracija

Mi prebacimo vaš sajt bez prekida — vi ništa ne radite.

24/7 podrška

Naši stručnjaci su tu 24/7 kroz tikete i live chat.