Create a standard WordPress .htaccess file

Create a standard WordPress .htaccess file

htaccess WordPress file

WordPress is a content management system for creating a website or blog. Indeed, WordPress currently manages more than 34% of websites on the internet. Whether you are a developer or not, with WordPress you can create your website without knowledge of coding. This article explains how to create a standard .htaccess WordPress file.

What is a .htaccess file?

The .htaccess file is an Apache configuration file used by most websites under WordPress. It indeed contains rules that give the server of your site different instructions. This file is usually located at the root of your website.

The WordPress .htaccess file manages the permalinks of your website. That is why the .htaccess file is changed as soon as the permalinks of your website are changed. However, it is possible that the .htaccess file is not created on your website before you first adjust your permanent links.

It can be useful to recreate the standard WordPress .htaccess file. When activating and / or deactivating some specific parameters you must indeed recreate your .htaccess file. This may be the case when making URL redirects, but also if you want to take certain security settings of your WordPress site into account.

How do you make a WordPress .htaccess file standard?

When you install WordPress on your web hosting, the .htaccess file is normally supplied. The file is accessible and visible on shared hosting. However, if you use cPanel hosting, it will be hidden for security reasons. Go to cPanel for the file to view the file “File manager“And click on”public_html“To get to the core of your web space. Then click on the buttonsettings“At the top of your screen and check the box”Show hidden files“.

If no .htaccess WordPress file is present, you must create this via File Manager. Once in the & # 39;public_html“, Click on”+ file“Top left of your screen.

htaccess

Specify the name of your file, .htaccess and click on the “Create new file“To create the latter.

htaccess

Click on the .htaccess file to select it and click on the “edit“.

htaccess

By default, the WordPress .htaccess file is as follows:


Rewrite Engine on
rewriteBase /
RewriteRule ^ index  .php $ - (L)
RewriteCond% {REQUEST_FILENAME}! -F
RewriteCond% {REQUEST_FILENAME}! -D
RewriteRule. /index.php (L)

Copy the above code to your .htaccess file and save it.

Once the .htaccess file has been createdit is necessary to check how your website works. In fact, A poorly configured .htaccess file can cause your website to fail and display a 500 error. In this case you have the option to re-modify your .htaccess file, but also to rename the same file in htaccess.txt to disable it.

conclusion

You can now recreate the standard .htaccess file for your WordPress site 👍

It should be noted that the .htaccess file is required to run WordPress, especially for the display of your pages. The file indeed contains the guidelines with which the permalinks of your website can be configured.

Discover our WordPress hosting offers and participate 😉

WordPress hosting