Trình tạo Htaccess

Trình tạo .htaccess trực tuyến miễn phí & Studio cấu hình Apache

Tạo các tệp cấu hình Apache .htaccess tùy chỉnh với chuyển hướng HTTPS, quy tắc WWW/không phải WWW, bộ nhớ đệm của trình duyệt, chặn IP và các tùy chọn bảo mật trong thời gian thực.

Cài đặt trước nhanh:

1. Quy tắc chuyển hướng & tên miền

2. Kiểm soát bảo mật và truy cập

Prevents visitors from seeing directory folder contents when no index file exists.

Mitigates clickjacking, MIME sniffing, and XSS vulnerabilities via mod_headers.

Supports Apache 2.4 (Require not ip) with automatic fallback for Apache 2.2.

4. Hiệu suất, bộ nhớ đệm và nén

Instructs browsers to cache static assets locally to reduce server bandwidth.

Compresses text, HTML, CSS, JS, and JSON data before sending it over the wire.

Routes all non-file/non-directory requests to /index.html for React, Vue, or Next export SPAs.

3. Trang lỗi tùy chỉnh

Đã tạo đầu ra .htaccess

.htaccess
# ================================================================
# Apache .htaccess Configuration File
# Generated by Tool 200 (https://tool200.com/htaccess-generator)
# 100% Client-Side Free .htaccess Generator
# ================================================================

# Disable directory file browsing
Options -Indexes

# Rewrite Engine Settings
<IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /

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

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

</IfModule>

# Custom Error Documents
ErrorDocument 404 /404.html
ErrorDocument 500 /500.html

# Essential Security Headers
<IfModule mod_headers.c>
    Header set X-XSS-Protection "1; mode=block"
    Header set X-Frame-Options "SAMEORIGIN"
    Header set X-Content-Type-Options "nosniff"
    Header set Referrer-Policy "strict-origin-when-cross-origin"
</IfModule>

# Leverage Browser Caching (Expires Headers)
<IfModule mod_expires.c>
    ExpiresActive On
    ExpiresDefault "access plus 1 month"

    # HTML document: don't cache or short cache
    ExpiresByType text/html "access plus 0 seconds"

    # CSS and JavaScript: 1 month
    ExpiresByType text/css "access plus 1 month"
    ExpiresByType text/javascript "access plus 1 month"
    ExpiresByType application/javascript "access plus 1 month"

    # Images & Favicons: 1 year
    ExpiresByType image/x-icon "access plus 1 year"
    ExpiresByType image/jpeg "access plus 1 year"
    ExpiresByType image/png "access plus 1 year"
    ExpiresByType image/gif "access plus 1 year"
    ExpiresByType image/webp "access plus 1 year"
    ExpiresByType image/svg+xml "access plus 1 year"

    # Web Fonts: 1 year
    ExpiresByType font/ttf "access plus 1 year"
    ExpiresByType font/woff "access plus 1 year"
    ExpiresByType font/woff2 "access plus 1 year"
</IfModule>

# Gzip / Deflate Compression
<IfModule mod_deflate.c>
    AddOutputFilterByType DEFLATE text/html text/plain text/xml text/css
    AddOutputFilterByType DEFLATE text/javascript application/javascript application/x-javascript
    AddOutputFilterByType DEFLATE application/json application/xml application/rss+xml
    AddOutputFilterByType DEFLATE image/svg+xml font/ttf font/otf
</IfModule>
100% được xử lý trong trình duyệt của bạn. Không có thông tin liên lạc hoặc đăng nhập máy chủ.

Tại sao nên sử dụng Công cụ 200 Trình tạo .htaccess trực tuyến miễn phí

Tối ưu hóa tốc độ máy chủ web Apache, thực thi HTTPS và miền chuẩn an toàn, tận dụng bộ nhớ đệm của trình duyệt và bảo vệ các thư mục nhạy cảm với bảo mật dựa trên trình duyệt 100%.

Chuyển hướng HTTPS & Canonical liền mạch

Thực thi lưu lượng HTTPS và dễ dàng lựa chọn giữa chuẩn hóa miền WWW và không phải WWW bằng cách sử dụng các quy tắc mod_rewrite đã được chứng minh.

Tận dụng bộ nhớ đệm và nén của trình duyệt

Bật tiêu đề mod_expires và nén gzip mod_deflate để tăng tốc đáng kể việc tải nội dung và nâng cao Google Core Web Vitals.

Tăng cường bảo mật web và bảo vệ IP

Vô hiệu hóa các chỉ mục thư mục (danh sách), hạn chế các địa chỉ IP không mong muốn và định cấu hình các trang lỗi tùy chỉnh (404, 500) mà không cần truyền máy chủ.

Brain Break nhanh chóng

Thư giãn đầu óc với một trò chơi nhỏ nhanh nhé?

Cần 2 phút thư giãn tinh thần? Bước vào trò chơi giải đố cổ điển ngay trong trình duyệt của bạn.