Create default WordPress .htaccess file

Category : WordPress

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
    How to create default WordPress .htaccess file

  3. 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
    How to create default WordPress .htaccess file
  4. Paste the following code in the file.
    # 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
  5. Save the file.
    Create default WordPress .htaccess file

Default .htaccess file for WordPress is created successfully.

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

How to Install WordPress in cPanel using Softaculous