WordPress .htaccess Generator
Generate a clean WordPress .htaccess file with HTTPS, redirects, security rules, and caching. Pick your options and copy the code.
- 100% Free
- No Sign-up
- Runs in Your Browser
- One-click Copy
Back up your current .htaccess first. Keep any blocks your caching or security plugin added, such as LiteSpeed Cache or Wordfence.
Generate a clean WordPress .htaccess file with HTTPS, redirects, security rules, and caching. Pick your options and copy the code.
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
</IfModule>
# END WordPress
What Is the WordPress .htaccess File?
The .htaccess file is a server configuration file that tells Apache and LiteSpeed web servers how to handle requests for your site. WordPress uses it to create pretty permalinks, and you can add rules for HTTPS, redirects, security, and caching. The file sits in the root folder of your WordPress install, next to wp-config.php.
The Default WordPress .htaccess Code
Every WordPress site on Apache or LiteSpeed needs the block between # BEGIN WordPress and # END WordPress. WordPress rewrites this block when you save your permalink settings, so add custom rules above it, never inside it.
How to Edit .htaccess Safely
- Download a copy of your current .htaccess file as a backup.
- Open your hosting File Manager and go to the WordPress root folder (usually public_html).
- Turn on “Show hidden files” if you cannot see .htaccess.
- Paste the generated code, keeping any blocks your caching or security plugin added.
- Save, then open your homepage and a few posts to confirm they load.
If the site shows a 500 Internal Server Error, restore your backup. The error almost always means a rule your server does not support.
Does .htaccess Work on Every Host?
| Web server | Uses .htaccess? |
|---|---|
| Apache | Yes |
| LiteSpeed (Hostinger, many shared hosts) | Yes |
| Nginx | No, rules go in the server config instead |
Frequently Asked Questions
Where is the .htaccess file in WordPress?
It is in the root folder of your WordPress install, the same folder that contains wp-config.php and the wp-content folder. Turn on hidden files in your File Manager to see it.
How do I regenerate the default .htaccess file?
Go to Settings, then Permalinks, and click Save Changes. WordPress rewrites its own block in the file automatically.
Why does my site show a 500 error after editing .htaccess?
A rule in the file is not supported by your server or has a typo. Restore your backup, then add rules back one section at a time to find the problem.
Should I block xmlrpc.php?
Block it if you do not use Jetpack, the WordPress mobile app, or remote publishing tools. It is a common target for brute-force login attacks.
Does this tool upload anything to my server?
No. The generator runs in your browser and only creates text that you copy into your own .htaccess file.
