Apache .htaccess Formatter & Validator

مطور
إعلان · يزيل؟
RewriteRule Flag Reference
Flagاسموصف
LآخرStop processing further rules
R[=code]RedirectIssue an external redirect (default 302)
NCNo CaseCase-insensitive pattern matching
QSAQuery String AppendAppend query string to substitution URL
NENo EscapeDon't escape special characters in output
PTPass ThroughPass to next handler (useful with Alias)
PProxyForce proxy request for substitution
FForbiddenReturn 403 Forbidden response
GGoneReturn 410 Gone response
جسلسلةChain current rule with the next rule
COCookieSet a cookie
هـEnvSet an environment variable
HHandlerForce a content handler
نالتاليRe-run rules from the start
TXTNo SubrequestSkip rule for internal sub-requests
سSkipSkip the next N rules
TيكتبForce MIME type
بEscape BackreferencesEscape non-alphanumeric backreference chars
DPIDiscard Path InfoDiscard PATH_INFO from rewritten URI
ENDنهايةStop processing and don't apply more rules

RewriteCond sets a condition that must match before the next RewriteRule is applied. Syntax: RewriteCond TestString CondPattern [flags]. Multiple RewriteCond lines before a RewriteRule are combined with AND logic by default.

Common Snippets
إعلان · يزيل؟

مرشد

Apache .htaccess Formatter & Validator

Apache .htaccess Formatter & Validator

Format and validate Apache .htaccess files with proper block indentation, syntax checking, and common error detection. Paste your .htaccess content and instantly see consistently formatted output with validation warnings for unclosed blocks, mismatched tags, invalid RewriteRule flags, and more. Includes common snippet templates and a RewriteRule flag reference.

كيف تستعمل

Paste your .htaccess content into the input area. The formatter processes it instantly — indenting block directives (IfModule, Directory, Files, etc.), normalizing comments, and validating syntax. Configure indent style (2 spaces, 4 spaces, or tabs), comment normalization, and blank line handling. Copy the formatted output or download it as an .htaccess file. Use the common snippets section to quickly insert standard configurations.

سمات

  • Block Indentation — Automatically indents nested directives inside IfModule, Directory, Files, FilesMatch, Location, LocationMatch, Limit, VirtualHost, Proxy, RequireAll, RequireAny, and other Apache block directives.
  • التحقق من بناء الجملة — Real-time error detection: unclosed blocks, extra closing tags, mismatched block types, missing RewriteEngine directive, invalid RewriteRule flags. Color-coded with line numbers.
  • RewriteRule Flag Checking — Validates flags in RewriteRule directives against the full list of known Apache flags (L, R, NC, QSA, NE, PT, P, F, G, C, CO, E, H, N, NS, S, T, B, DPI, END).
  • Comment Handling — Preserves all comments with optional normalization (ensures space after #). Inline comments maintained in position.
  • Formatting Options — Configurable indent style (2 spaces, 4 spaces, tab), comment normalization toggle, blank line collapsing.
  • Common Snippets — Quick-insert templates: force HTTPS, trailing slash handling, custom error pages, IP blocking, GZIP compression, cache headers, directory listing prevention.
  • RewriteRule Reference — Collapsible reference table with all RewriteRule flags and their descriptions, plus RewriteCond/RewriteRule syntax guide.
  • تصدير — Copy formatted output or download as .htaccess file.

Validation Checks

Block matching: Every opening block tag must have a corresponding closing tag of the same type. RewriteEngine: Warns if RewriteRule or RewriteCond directives are used without RewriteEngine On. Flag validation: Checks RewriteRule flags against known Apache mod_rewrite flags. Duplicate detection: Alerts when the same directive appears multiple times (may be intentional but worth reviewing).

إعلان · يزيل؟

What is an .htaccess file?

An .htaccess (hypertext access) file is a directory-level configuration file for Apache HTTP Server. It allows you to override server configuration on a per-directory basis without editing the main httpd.conf. Common uses include URL rewriting (pretty URLs, redirects), access control (password protection, IP blocking), custom error pages, MIME type configuration, and caching headers. The file is named .htaccess (with a leading dot) and is placed in the directory you want to configure.

What are the most common RewriteRule flags?

The most frequently used flags are: [L] (Last — stop processing rules), [R=301] (Redirect — send HTTP redirect, 301 for permanent), [NC] (No Case — case-insensitive matching), [QSA] (Query String Append — preserve existing query string), [NE] (No Escape — don’t encode special characters), [P] (Proxy — handle via mod_proxy), [F] (Forbidden — return 403), and [END] (like L but also prevents further .htaccess processing in subdirectories). Multiple flags are combined with commas: [L,R=301,NC].

Why does my .htaccess redirect loop?

Redirect loops usually happen when a RewriteRule matches its own output. For example, redirecting all requests to HTTPS will loop if the rule doesn’t check whether the request is already HTTPS. Always add a RewriteCond before redirect rules: RewriteCond %{HTTPS} off (for HTTPS redirects) or RewriteCond %{REQUEST_URI} !^/target (to exclude the target path). Also check for conflicting rules — multiple redirect rules can create circular references. The [L] flag helps by stopping rule processing after a match.

Is my .htaccess content sent to a server?

No — all formatting and validation happens in your browser using JavaScript. Your .htaccess content never leaves your device. This is important because .htaccess files can contain sensitive configuration: access control rules, internal paths, IP addresses, and security settings. All processing runs entirely client-side with no API calls or data storage.

هل تريد حذف الإعلانات؟ تخلص من الإعلانات اليوم

تثبيت ملحقاتنا

أضف أدوات IO إلى متصفحك المفضل للوصول الفوري والبحث بشكل أسرع

أضف لـ إضافة كروم أضف لـ امتداد الحافة أضف لـ إضافة فايرفوكس أضف لـ ملحق الأوبرا

وصلت لوحة النتائج!

لوحة النتائج هي طريقة ممتعة لتتبع ألعابك، يتم تخزين جميع البيانات في متصفحك. المزيد من الميزات قريبا!

إعلان · يزيل؟
إعلان · يزيل؟
إعلان · يزيل؟

ركن الأخبار مع أبرز التقنيات

شارك

ساعدنا على الاستمرار في تقديم أدوات مجانية قيمة

اشتري لي قهوة
إعلان · يزيل؟