RevealTheme logo

เครื่องมือสร้างสนิปเพ็ต .htaccess

สร้างกฎ .htaccess ที่ใช้กันทั่วไป: บังคับใช้ HTTPS, เปลี่ยนเส้นทาง www, ตั้งค่า header ของแคช, เปิดใช้งาน Gzip

RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

วิธีใช้เครื่องมือนี้

  1. 1

    Open the dropdown and choose the rule you need (for example, Force HTTPS or Gzip compression).

  2. 2

    Read the generated snippet shown in the code box below the dropdown.

  3. 3

    Select the text and copy it, then paste it into your site's .htaccess file.

  4. 4

    Switch the dropdown to a different rule to view another snippet — combine several by pasting them one after another.

เครื่องมือสร้างสนิปเพ็ต .htaccess คืออะไร?

.htaccess คือไฟล์การกำหนดค่าแบบรายไดเรกทอรีของ Apache มันควบคุมการเขียน URL ใหม่ การเปลี่ยนเส้นทาง การแคช การบีบอัด และ header ด้านความปลอดภัย Hostinger และโฮสติ้งแบบแชร์ส่วนใหญ่ใช้ Apache (หรือ LiteSpeed ซึ่งใช้งานร่วมกันได้) สนิปเพ็ตเหล่านี้ครอบคลุมความต้องการที่พบบ่อยที่สุด

กรณีการใช้งานทั่วไป

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

คำถามที่พบบ่อย

.htaccess ใช้งานได้บน Nginx หรือไม่?
ไม่ได้ Nginx ใช้ไวยากรณ์การกำหนดค่าของตัวเอง สนิปเพ็ตเหล่านี้ใช้ได้กับ Apache/LiteSpeed เท่านั้น
ฉันควรวาง .htaccess ไว้ที่ไหน?
ในรากของเว็บไซต์ของคุณ (ข้างๆ index.html) กฎจะถูกนำไปใช้กับไดเรกทอรีนั้นและไดเรกทอรีย่อยทั้งหมด

เครื่องมือที่เกี่ยวข้อง

เครื่องมือสร้างรหัสผ่าน

สร้างรหัสผ่านที่ปลอดภัยด้วยการเข้ารหัสภายในเบราว์เซอร์ของคุณ ไม่มีการส่งข้อมูลใดๆ ไปยังเซิร์ฟเวอร์ ไบต์สุ่มมาจาก crypto API ของเบราว์เซอร์ของคุณ

ตัวสร้างชื่อผู้ใช้ WordPress

สร้างชื่อผู้ใช้ผู้ดูแลระบบ WordPress ที่ปลอดภัยและสุ่มขึ้นมา อย่าใช้ 'admin' เด็ดขาด เพราะเป็นเป้าหมายอันดับหนึ่งของการโจมตีแบบ brute force

เครื่องมือสร้างชื่อโดเมน

สร้างไอเดียชื่อโดเมนที่มีศักยภาพในการสร้างแบรนด์จากคำสำคัญ การผสมคำรวมถึงคำนำหน้า คำต่อท้าย และตัวขยายที่พบบ่อย

เครื่องมือสร้างชื่อธุรกิจ

สร้างไอเดียชื่อธุรกิจที่มีศักยภาพในการสร้างแบรนด์ ผสมผสานคำจริงเข้ากับคำขยายเพื่อสร้างชื่อที่น่าจดจำ

ตัวสร้าง Slug ของ URL

แปลงข้อความเป็น slug ที่เหมาะกับ URL: เปลี่ยนเป็นตัวพิมพ์เล็ก ลบอักขระพิเศษ และคั่นคำด้วยขีดกลาง

ตัวสร้าง Lorem Ipsum

สร้างข้อความเติมเต็มสำหรับแบบจำลองและงานออกแบบ เลือกได้ทั้งย่อหน้า ประโยค หรือคำ

สมัครรับข่าวสารอัปเดต

เราไม่ขายอีเมลของคุณ เราไม่ส่งสแปม

© 2026 RevealTheme. All rights reserved.