Free tool · no sign-up
WordPress .htaccess generator
Get the default WordPress .htaccess file back, or build one with HTTPS, www and security rules. Everything runs in your browser; nothing is sent anywhere.
Paste over the whole file. Custom rules go above # BEGIN WordPress, because WordPress rewrites everything between its own markers.
What .htaccess is
.htaccess is a settings file for Apache and LiteSpeed web servers, which most WordPress hosts use. It sits in the same folder as wp-config.php. WordPress uses it so that pretty links like /about/ work. The file name starts with a dot, so many file managers hide it until you turn on "show hidden files".
The default WordPress .htaccess
This is the standard block from the WordPress handbook for a normal single site:
# BEGIN WordPress
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]
# END WordPress
WordPress itself often writes the same lines wrapped in <IfModule mod_rewrite.c>, with a few comment lines. Both work the same.
The quickest way to get it back
If your links suddenly give 404 errors, you often don't need to edit anything: go to Settings → Permalinks and click Save Changes without changing anything. WordPress rewrites its block in .htaccess for you, as long as the file is writable.
Before you edit it
- Download a copy first. One typo in
.htaccesscan take the whole site down with a "500 Internal Server Error". - If that happens, put your copy back, or rename the file to
.htaccess-offto get the site up while you fix it. - Nginx servers don't read
.htaccessat all. If your host uses Nginx, these rules have to go in the server config instead.
Site broken after an .htaccess change? Emergency Fix, $129.
FAQ
Questions people ask
Where is the .htaccess file in WordPress?
In the site's main folder, the same one that holds wp-config.php and the wp-content folder. Its name starts with a dot, so switch on “show hidden files” in your file manager or FTP program.
Why can't I find my .htaccess file?
Three usual reasons: hidden files aren't shown, WordPress hasn't created it yet (it does when you save Settings → Permalinks), or your server runs Nginx, which doesn't use .htaccess at all.
How do I reset .htaccess to the WordPress default?
Rename the current file to .htaccess-old as a backup, then go to Settings → Permalinks and click Save Changes. Or paste the default block from this page into a new .htaccess file.
Is it safe to delete .htaccess?
Rename it rather than delete it. WordPress can recreate its own rules, but anything else in the file, like redirects, caching or security rules added by plugins, would be lost.
Does every WordPress site need .htaccess?
Sites on Apache or LiteSpeed servers need it for normal page addresses (permalinks). Sites on Nginx set the same rules in the server configuration instead.
Rather have someone else do it?
A Quick Fix is $69: one problem, about an hour of work, with a backup first and a note of what I changed.
Fixed price before I start · backup first · no fix, no fee · or run the free scan