広告が嫌いですか? 行く 広告なし 今日

Apache .htaccess Formatter & Validator

開発者
広告 ・ 取り除く?
RewriteRule Flag Reference
Flag名前説明
LLastStop 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
CChain current rule with the next rule
COCookieSet a cookie
EEnvSet an environment variable
HHandlerForce a content handler
NRe-run rules from the start
– ドメインに対して権威のあるネームサーバーNo SubrequestSkip rule for internal sub-requests
SSkipSkip the next N rules
TタイプForce MIME type
BEscape 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ツールを追加して、すぐにアクセスし、検索を高速化します。

に追加 Chrome拡張機能 に追加 エッジ拡張 に追加 Firefox 拡張機能 に追加 Opera 拡張機能

スコアボードが到着しました!

スコアボード ゲームを追跡する楽しい方法です。すべてのデータはブラウザに保存されます。さらに多くの機能がまもなく登場します!

広告 ・ 取り除く?
広告 ・ 取り除く?
広告 ・ 取り除く?

ニュースコーナー 技術ハイライト付き

参加する

価値ある無料ツールの提供を継続するためにご協力ください

コーヒーを買って
広告 ・ 取り除く?