.htaccess Redirect Generator
Generates .htaccess redirect rules for pages, HTTPS, www, and domain moves.
Check an Apache .htaccess file for mistakes before you upload it. Typos in directives, unclosed blocks, bad RewriteRule flags, and invalid patterns are listed by line.
The file is read line by line, the way Apache reads it: comments start with #, and a line ending in \ continues on the next line.
.htaccess. Close misspellings, such as RewriteCondtion, get a suggestion.<IfModule>, <FilesMatch>, and <If> must be closed in the right order. <Directory> and <VirtualHost> are errors, because Apache refuses them in .htaccess.RewriteRule needs a pattern and a target, and its flags are checked against the known list (L, R=301, NC, QSA, and so on). RewriteCond flags are checked too.Redirect status codes and ErrorDocument codes are range-checked.RewriteEngine On
RewriteCondtion %{HTTPS} off
RewriteRule ^(.*$ https://%{HTTP_HOST}/$1 [R=301,L,X]
<IfModule mod_expires.c>
ExpiresActive OnRewriteCondtion. Did you mean RewriteCond?^(.*$ has an unclosed parenthesis.X.<IfModule> is never closed. Add </IfModule>.AllowOverride forbids the directive.Apache stops at any directive it doesn't understand or that isn't allowed there. A typo, a missing module, or an unclosed block are the usual causes. The server's error log names the exact line.
No. An .htaccess file already applies to its own directory. Use <Files> or <FilesMatch> for per-file rules instead.
No, it checks syntax only. Try the rules on a staging site, or use the Regex Tester to test a pattern against sample paths.
No. It is checked in your browser.
Often used together with the .htaccess Validator.
Generates .htaccess redirect rules for pages, HTTPS, www, and domain moves.
Creates .htpasswd lines with bcrypt, APR1-MD5, or SHA-1 hashes for Basic Auth.
Highlights regex matches live, lists capture groups and offsets, and previews replacements.