Create default WordPress .htaccess file

WordPress requires a .htaccess file to reconfigure specific settings on your website. WordPress uses htaccess file to force HTTPS, create and manage Redirection of website. Incorrect rules in this file can lead to downtime on the website. In this guide, we are going to learn how to create the default WordPress .htaccess file.

Requirements to create the default WordPress .htaccess file :

  • WordPress installed on a domain
  • File Manager or FTP access to edit and create a new file

Procedure :

  1. Navigate to the root directory of your website.
  2. Create a new file and name it .htaccess

htaccess files 01

Right-click on the newly created file, Open the newly created file with an editor.
Note: If you are unable to view the file then follow the guide below to enable viewing the hidden files on cPanel.
Guide to show hidden Files

htaccess files 02

Paste the following code in the file.
# BEGIN WordPressRewriteEngine 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

htaccess files 03

Default .htaccess file for WordPress is created successfully.

Find the guide to Force HTTPS for WordPress websites by .htaccess

Leave a Reply