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 :
- Navigate to the root directory of your website.
- Create a new file and name it .htaccess
- 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
- 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
-
Save the file.
Default .htaccess file for WordPress is created successfully.
Find the guide to Force HTTPS for WordPress websites by .htaccess