Generator Cuplikan .htaccess
Hasilkan aturan .htaccess yang umum: paksa HTTPS, alihkan www, atur header cache, aktifkan Gzip.
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]Cara menggunakan alat ini
- 1
Open the dropdown and choose the rule you need (for example, Force HTTPS or Gzip compression).
- 2
Read the generated snippet shown in the code box below the dropdown.
- 3
Select the text and copy it, then paste it into your site's .htaccess file.
- 4
Switch the dropdown to a different rule to view another snippet — combine several by pasting them one after another.
Apa itu Generator Cuplikan .htaccess?
.htaccess adalah file konfigurasi per direktori milik Apache. Ia mengontrol penulisan ulang URL, pengalihan, cache, kompresi, dan header keamanan. Hostinger dan sebagian besar hosting bersama menggunakan Apache (atau LiteSpeed, yang kompatibel). Cuplikan ini mencakup kebutuhan yang paling umum.
Kasus penggunaan umum
Forcing every visitor onto HTTPS after installing an SSL certificate on a shared Apache or LiteSpeed host.
Canonicalizing a domain to either the www or non-www version with a 301 redirect to consolidate SEO signals.
Adding a one-year browser cache to static assets so repeat visitors load CSS, JS, and modern image formats from cache.
Turning on Gzip compression for text responses to cut transfer size and improve page load time.
Hiding the contents of a folder that has no index file by disabling Apache's automatic directory listing.
Blocking PHP execution inside a public uploads directory so an attacker can't run a script they managed to upload.
Pertanyaan yang sering diajukan
Apakah .htaccess berfungsi di Nginx?▼
Di mana saya meletakkan .htaccess?▼
Alat terkait
Pembuat Kata Sandi
Buat kata sandi yang aman secara kriptografis di peramban Anda. Tidak ada yang dikirim ke server mana pun: byte acak berasal dari API crypto peramban Anda.
Generator Nama Pengguna WordPress
Hasilkan nama pengguna administrator WordPress yang aman dan acak. Jangan pernah gunakan 'admin': itu adalah target serangan brute force nomor satu.
Generator Nama Domain
Hasilkan ide nama domain dengan potensi merek dari sebuah kata kunci. Kombinasinya mencakup prefiks, sufiks, dan modifikator umum.
Generator Nama Perusahaan
Hasilkan ide nama perusahaan dengan potensi merek. Gabungkan kata-kata nyata dengan pengubah untuk menghasilkan nama yang mudah diingat.
Generator Slug URL
Ubah teks menjadi slug yang aman untuk URL: jadikan huruf kecil, hapus karakter khusus, dan pisahkan kata dengan tanda hubung.
Generator Lorem Ipsum
Hasilkan teks pengisi untuk mockup dan desain. Pilih paragraf, kalimat, atau kata.