Skip to content
WORDPRESS

WordPress Default htaccess File

By Published: Last updated: 1 min read

Default WordPress .htaccess file with rewrite rules for handling server requests.

Default WordPress .htaccess file. WordPress uses the default .htaccess file to store configuration information and handle server requests.

WordPress uses this file to manipulate how Apache serves files from its root directory, and subdirectories thereof. Most notably, WP modifies this file to be able to handle pretty permalinks.

Default htaccess file for WP

# 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

What is .htaccess file?

Htaccess is a configuration file of apache which is used to make changes in the configuration on a directory basis. Htaccess file is used to do changes in functions and features of the apache server.

Frequently asked questions

What is an .htaccess file?

An .htaccess file is an Apache configuration file that lets you change server settings on a per-directory basis.

How does WordPress use the .htaccess file?

WordPress uses it to control how Apache handles requests and serves files from the WordPress root directory and its subdirectories. WordPress modifies the file to support pretty permalinks.

What does the default WordPress rewrite configuration do?

It enables Apache’s rewrite engine and routes requests that match neither an existing file nor an existing directory to /index.php.

Can I use the default WordPress .htaccess rules to restore a corrupted file?

Yes. The default rules shown in the article can be used to restore a corrupted WordPress .htaccess file.

Related posts

SEO

What is a Campaign URL? What is UTM?

A campaign URL adds UTM parameters such as source and medium to a link so you can track traffic and conversions for each marketing campaign in Google Analytics.

· 3 min read

WORDPRESS

How to Secure WordPress?

Secure WordPress by updating core, themes, and plugins, choosing managed hosting, using strong, unique passwords, limiting login attempts, and enabling two-factor authentication.

· 5 min read