.htaccess file in Wordpress

Author - Kajal Marwaha
10.10.2018
|
0 Comments
||

.htaccess in wordpress, its purpose & how to edit it

.htaccess file in wordpress is used for the functionality like redirecting visitors to our site, beefing up site’s security etc. .htaccess is the distributed configuration file which is only readable by server. It’s a hidden file and has no extension.

The main role of .htaccess file is to control how the site permalinks can be displayed. All settings for displaying permalinks of site and subsites are done in this file. .htaccess file is located in the root directory of the WordPress installation. It allows us to write the permalink settings for the wordpress page urls. When we change the url permalink structure in wordpress, .htaccess file automatically updates with new instructions for the server.

There are a number of uses of .htaccess file which are as follows:

1. Tell visitors that what page to show when there is a error.
2. Used to protect the open searching of folders by visitors.
3. Used in permanently or temporary redirecting from one page to another.
4. Used to prevent the access to some folders and subfolders.

How to edit .htaccess file

We can ftp and edit the .htaccess file using filezilla and a text editor.

Changing the .htaccess file from filezilla –
1. Firstly open the filezilla. Access the folders of site for editing by using hostname, username and password. Open the root folder of website like this:

.htaccess file in WordPress

2. For editing, right click on .htaccess file and click on View/Edit option.
.htaccess file in WordPress

3. File will be open like this in your text editor where you can easily edit it.
.htaccess file in WordPress

In .htaccess file we can also include the expires headers.

Expires Headers are used to decrease page load time for returning visitors by getting the page from browser cache. Expires headers defines the expiry date for each object of website.

Example:

ExpiresActive On
ExpiresByType text/javascript “access plus 1 month”

Here we are setting the expiry time of javascript files to 1 month from initial access. Therefore when the user will revisit there within 1 month, javascript files will be fetched from browser cache.

Webner Solutions is a Software Development company focused on developing Insurance Agency Management Systems, Learning Management Systems and Salesforce apps. Contact us at dev@webners.com for your Insurance, eLearning and Salesforce applications.

Leave a Reply

Your email address will not be published. Required fields are marked *