.htaccess Generator Online

Common Apache rules toggle karein aur ek ready-to-use .htaccess copy karein, poori tarah aapke browser mein generate.

Aapke domains, redirect paths, aur IP addresses .htaccess banane ke liye locally aapke browser mein process hote hain, aur kuch bhi server par upload nahi hota.

File permissions set kar rahe hain? chmod Calculator try karein.

.htaccess Generator ke baare mein

Yeh .htaccess generator toggles se ek valid Apache configuration file banata hai, taaki aapko mod_rewrite syntax yaad na rakhni pade. Jo rules aapko chahiye unhe on karein aur output live update hota hai: force HTTPS, www ya non-www canonicalise karein, custom 301 redirects add karein, specific IP addresses deny karein, custom 404 aur 500 error pages set karein, gzip compression enable karein, mod_expires se browser caching on karein, directory listing disable karein, ek default DirectoryIndex set karein, aur X-Frame-Options aur Referrer-Policy jaise basic security headers add karein. Rewrite-based rules ek single mod_rewrite block mein ek RewriteEngine On ke saath wrap hote hain, aur har section ko ek comment header milta hai taaki file readable rahe. Yeh developers aur site owners ke liye banaya gaya hai jo ek site ko HTTPS par move kar rahe hain ya ek apache redirect wire up kar rahe hain. Poori cheez aapke browser mein chalti hai, isliye aapke domains, paths, aur IPs kabhi aapke device se bahar nahi jaate.

Features

.htaccess Generator kaise use karein

  1. Jo sections aapko chahiye unhe on toggle karein, jaise Force HTTPS ya Browser caching.
  2. Koi bhi inputs bharein, jaise redirect from/to paths ya block karne ke liye IP addresses.
  3. Right side ke panel mein .htaccess output ko live build hote dekhein.
  4. Copy par click karein, ya file ko apni site root mein .htaccess ke roop mein save karne ke liye Download par click karein.

Example

Input

Force HTTPS: on
Force www / non-www: remove www
Redirect: /old-page -> https://example.com/new

Output

<IfModule mod_rewrite.c>
  RewriteEngine On

  # Redirect all HTTP requests to HTTPS
  RewriteCond %{HTTPS} off
  RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

  # Force non-www (strip www)
  RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
  RewriteRule ^(.*)$ https://%1/$1 [L,R=301]

  # Custom 301 redirects
  RewriteRule ^old-page/?$ https://example.com/new [L,R=301]
</IfModule>

HTTPS, non-www, aur ek custom redirect ek hi mod_rewrite block share karte hain.

Common errors aur troubleshooting

Aksar pooche jaane wale sawaal

.htaccess generator kya hai?
Yeh ek in-browser tool hai jo simple toggles aur inputs ko ek valid Apache .htaccess file mein badal deta hai, jisme HTTPS redirects, www canonicalisation, 301 redirects, IP blocking, compression, caching, aur security headers cover hote hain, copy ya download ke liye ready.
.htaccess mein HTTPS kaise force karoon?
Force HTTPS toggle enable karein. Yeh ek mod_rewrite rule add karta hai jo RewriteCond %{HTTPS} off check karta hai aur har request ko usi URL ke https:// version par 301-redirect karta hai.
.htaccess file kahan jaati hai?
Use apni site ke document root mein rakhein (ya us specific directory mein jise yeh affect kare), use exactly .htaccess naam dein leading dot ke saath, aur sunishchit karein ki us directory ke liye aapke Apache config mein AllowOverride enabled hai.
Is htaccess generator se ek 301 redirect kaise set up karoon?
Custom 301 redirects on karein, From field mein old request path aur To field mein new URL enter karein, aur jitni rows chahiye add karein; har ek [L,R=301] flags wala ek RewriteRule ban jaata hai.
Kya yeh Nginx ke liye bhi kaam karta hai?
Nahi. .htaccess ek Apache feature hai. Nginx ise ignore karta hai aur iski jagah nginx.conf mein server-block directives use karta hai, isliye yeh output Apache ya LiteSpeed servers ke liye hai.
Jab main ise generate karta hoon to kya meri configuration kahin bheji jaati hai?
Nahi. .htaccess generator poori tarah aapke browser mein chalta hai, isliye jo domains, paths, aur IP addresses aap enter karte hain woh locally process hote hain aur kabhi aapke device se bahar nahi jaate.

Related tools

Saare ArrayKit tools