What Is the .htaccess File in WordPress? How to Use It?

Photo of author

By Sameeksha Medewar

The .htaccess is a file that is responsible for controlling the configuration of a website. Servers that run Apache make use of the .htaccess file to facilitate any changes on a website’s configuration without the need for editing the server configuration files. Also, the .htaccess file is necessary for controlling how a web server reacts to different requests. The file allows you to properly manage a server but it can be a little complicated to use it.

You must be well familiar with the .htaccess file for making any changes to the server. In this article, you will learn about the .htaccess file and its use in WordPress.

What is the .htaccess File?

In simple words, .htaccess is a configuration file that helps in controlling various aspects of a web server. It is supported by numerous web servers, including the Apache web server that is used by many commercial web hosting providers.

.htaccess file is located in the directory, which when loaded with the Apache web server allows overriding of configuration settings of .htaccess directives to go higher in the tree. It helps the user to set server configurations for a particular directory. This can be the root directory of a user’s website or a ‘/downloads’ or ‘/images’ directory.

A .htaccess file largely impacts the SEO of a website and has a powerful role in terms of SEO. A well-written .htaccess file will make the site easily crawlable, indexable, and deconflict ranking signals while also increasing page load speed.

Mostly .htaccess is used on the Apache webserver; however, it can be used on other web servers too like LiteSpeed.

How Does .htaccess Work on WordPress?

Let’s understand how to use the .htaccess file on WordPress. A WordPress site depends on several ‘core files’ to perform its job, and .htaccess is one of those files. It can be customized to perform various functions like rerouting visitors to your site and tightening your site’s security besides doing other tasks related to the site’s permalinks.

As explained before, the .htaccess file works as a configuration file for several web servers. It contains rules which give various instructions to a website server. Almost every WordPress website has a .htaccess file placed in the central directory (root directory). The file name starts with a period as it is a hidden file without any extension.

.htaccess file controls how a WordPress site’s permalinks are displayed. Whenever you change your site’s permalinks, the .htaccess file gives new instructions to the server. To be precise, most of the time .htaccess isn’t created on the site until the user modifies the permalinks. You can also make use of the .htaccess file to make different improvements to the site’s functionality.

Also, few plugins will add their various rules to the .htaccess file for introducing new functionality to the website.

Locating and Editing the .htaccess file in WordPress

Before we learn about locating and editing the .htaccess file in WordPress, we must know that changing the site’s files directly can compromise your site’s security. Therefore, you must be careful, or you might end up destroying your site’s functionality.

Following are the few measures which you must employ:

  • Take a backup of your site before you edit any of the files. This allows you to easily reverse the unnecessary changes that you made.
  • Make use of a staging site to test your changes/edits before making them on the live site. A staging site allows you to freely experiment without any risks.
  • It’s important to download the .htaccess file on your PC before you make any edits. So, if you break anything mistakenly into your .htaccess file, you can upload the original copy for fixing the issues.

Follow these steps to access the .htaccess file in WordPress:

  • Step 1 – Establish a direct connection to the website using the File Transfer Protocol (FTP). For this, you will need an FTP client along with some FTP credentials from the web host.
  • Step 2 – Check for the folder named after your site’s domain. Now look for the files and folders located under this folder. You will spot the .htaccess file here.


  • Step 3 – Right-click on the file and click on View/Edit and open it in the computer’s text editor.

computer's text editor

  • Step 4 – Make whatever changes you wish to make using the text editor. Now save and close the file.
  • Step 5 – A window pops up, asking whether you want to upload the new and edited version of the .htaccess file to the server. Click on Yes, and your changes will be saved immediately.

Note: Sometimes, users aren’t able to find the .htaccess file in the root folder because it may not exist yet. However, you can create one by going to Settings>Permalinks in the dashboard and then clicking on the Save Changes option.

Being running on the largest number of, mostly, mobile devices across the world, Android is currently the most commonly used mobile operating system. It was mainly developed to support touchscreen mobile phones and tablets. Developed by a group of developers known as the Open Handset Alliance, Android is backed by Google. Chances are high that you might be reading this article on your Android device, may it be your smartphone or your new tablet. So, the question is, do you know how to check for the Android version on your device, be it a smartphone or any other mobile device. If your answer is no then keep reading as here’s how step-by-step. But before that let’s first know a little more about the world’s leading mobile platform. <h2><strong>Intuitive and Engaging: Android User Interface</strong></h2> Android's user interface mainly depends on direct manipulation, which uses touch-inputs corresponding to real-world actions, such as tapping, swiping, pinching, along with reverse pinching to handle on-screen objects as well as a virtual keyboard. The home screens mostly consist of widgets and app icons where the latter is for launching the associated applications while widgets are for delivering/displaying auto-updated information like the weather forecast, and news headlines. There are even third-party applications available on Google Play that can be used to refurbish the theme (display) of the screen. The top of the screen has a status bar that has details about the device and connectivity. It can be pulled, by swiping, downwards to show a notification screen where you can see important updates of various applications and do a lot of other stuff. <h2><strong>How to Check for Android Version?</strong></h2> So, are you ready to check the Android version running on your device, then follow these steps: <ul> <li><b>Step 1 </b>- Go to Settings of your device.</li> <li><b>Step 2</b> - Now scroll down and select 'About Phone.'</li> <li><b>Step 3</b> - Go to 'Android version' in the 'Software Information' section, and you will be able to see the Android version your device is running on.</li> </ul> <h3><strong>How to Update My Device to the Latest Version of Android?</strong></h3> Different device models from various manufacturers receive Android software updates at different times. Whenever there's a new update available for a device, it shows a notification alert showing the update along with its details, like download size, bug fixes, and what’s new. Besides, you can also check the Software Updates section to regularly check for updates. This section also contains instructions and information regarding an update and how to proceed with it. Usually, for smartphones, Android suggests having a Wi-Fi connection to update, probably due to having a size in a couple of hundred MBs to a few GBs. But, you can connect to the mobile network too to update your Android device to the latest available version of the leading mobile OS. <h3><strong>10 Things You Must Know About the Latest Android Version: Android 11</strong></h3> Android 11 was recently launched in September 2020. However, it has seen a limited release, for now, on a few smartphone series, including Google Pixel, Oppo, Xiaomi, OnePlus, and RealMe. This means that Android 10 is ruling over most of the Samsung smartphones along with other brands. Anyways, unlike other Android versions (up to Android 10 Q), this version is not named after a delicious dessert, and it is called just Android 11. Though it was codenamed 'Red Velvet Cake' during the development. As we are aware that Android 10 is the most-used Android version globally, it is better to learn more about it. The release of Android 10 focused on making our daily life easier with built-in support for novel technologies, like 5G and Foldable, as well as features leveraged by on-device machine learning. Not to mention, Android 10 comes with over 50 modifications associated with security and privacy while offering more transparency and protection than ever while letting you have full control over your data. So, here are 10 features centered around innovation, privacy, security, and digital wellbeing of a device, that you must learn about Android 10 version: <h4><strong>1. Smart Reply</strong></h4> It suggests actions that simply mean that when someone receives a message in the form of a YouTube video or an address, they can open or navigate it in Google Maps or just open it in YouTube without any copy-and-paste technique. Smart Reply works on all popular messaging applications. <h4><strong>2. Gesture Navigation</strong></h4> This allows you to move between tasks (screens), swiping, go backward, or simply pulling up the screen. If you haven’t tried it yet, then be assured that Gesture navigation is so convenient that you won't prefer to switch back to visible buttons once you use it. <h4><strong>3. Dark Mode or Dark Theme</strong></h4> Android 10 allows you to turn your phone's theme into Dark Theme. A lot of people prefer to turn on the Dark Theme as it's easy on the eyes, plus it saves the battery too. <h4><strong>4. Live Caption</strong></h4> This feature allows the user to caption anything from videos to podcasts as well as audio messages over any application. You can even give captions to anything you record yourself. Moreover, the Live Caption is available on Google Pixel smartphones. <h4><strong>5. Enhanced Privacy</strong></h4> There is a new Privacy section available in Android 10 that offers settings like Web & App Activity along with Ad Settings all in a single place. <h4><strong>6. Automated Security Checks</strong></h4> The user can only share location data with the application while using them. If an app accesses your location even when you are not using it, you will get a reminder regarding it. This gives you the liberty to decide whether you wish to share your location or not. <h4><strong>7. Google Play System Updates</strong></h4> This feature sends important security and privacy fixes from Google Play to the phone. This way, you can receive the fixes as soon as they are available without waiting for an official update. <h4><strong>8. Family Link</strong></h4> This is another important feature offered by Android 10 under Settings in Digital Wellbeing. As a parent, you can use this tool to fix digital ground rules, such as device bedtime, screen time limits, and time limits for a particular application. It also helps to review the apps used by children on their devices. <h4><strong>9. Entirely Controlled Customization</strong></h4> Android 10 also offers better control on when and where you are alerted by different notifications. It gives you an option to mark notifications as 'Silent' on your device so that they don't make any noise or show on the lock screen. <h4><strong>10. Focus Mode</strong></h4> Now you have Focus Mode in the Digital Wellbeing section, which lets you select the apps that are distracting and put them on silent till you come out of the Focus Mode. Besides the above features, there's lots more that Android 10 offers, like the new enterprise feature with different keyboards for your personal and professional profiles and gender-specific emoji. <h3><strong>Frequently Asked Questions</strong></h3> Here are some important Frequently Asked Questions for you to know: <b>Question</b>: Do I have to pay a cost for updating the Android version on my device? <b>Answer</b>: No, you don't have to pay anything for updating the Android OS as it is completely free. <strong>Question</strong><strong>:</strong> Will I need a Gmail account for using Android on my device? <b>Answer</b>: No, it's not mandatory. However, it is recommended to use one as a lot of services and applications require signing in through a Gmail account. Also, a Gmail account is necessary for using Google Play in order to download applications. <b>Question</b>: Will I be able to transfer content, including pictures, contacts, videos, files, etc., from one Android device to another one? <b>Answer</b>: Yes definitely, you can do this through a Gmail account and by syncing your device with any other Android device. You just have to sign in to your Gmail account on any device you need to transfer the data to. <b>Question</b>: How many Android apps can be opened at a time? <b>Answer</b>: The number of apps that can be opened simultaneously depends on the device because the Android OS stops a few idle apps from running on the device. It is suggested that you close the applications you are not using in order to cut the battery consumption while helping your device to run at its optimal speed. <b>Question</b>: Can we purchase an Android device online? <b>Answer</b>: Yes, Android devices can be purchased online on various e-commerce websites. <b>Question</b>: If Google crashes, will there be a problem in running Android apps? <b>Answer</b>: No, Google is a set of services that run independently from Google Play applications. Google services like Gmail and Google Calendar may not get updates or you may not be able to use a specific function of the same if any service stops working. <b>Question</b>: How can I troubleshoot an issue on my Android device? <b>Answer</b>: The online tech support assistants can help you if a problem arises on your Android device, though it solely depends on the brand and model of the device you’re using. <h2>Conclusion</h2> That’s all! Now you’ve learned how to check for the Android Version in Smartphones. If you’re still unable to find it, feel free to drop us a comment.

How Can You Use the .htaccess File in WordPress?

You can do a lot of things using the .htaccess file in WordPress such as redirecting a post or page of your website or even the entire website.

If you wish to redirect a post or page or the complete website, you will have to direct the visitors visiting the old URL to the new URL. For this, you need to set up a 301 redirect, and to redirect a single page add the following line to the bottom of your .htaccess file:

Redirect 301 /oldpage.html http://www.yoursite.com/newpage.html

The user will have to replace /oldpage.html with the old permalink as well as the following URL with the new link on the page. You are allowed to add a separate line for every page you need to redirect.

Besides, a user can use similar snippets to redirect their entire website. You can even use a snippet to send all the traffic to the HTTP version of the site.

.htaccess file can also be used to make various security-related modifications to a WordPress site. For example, you can use the following code to prevent unauthorized users from accessing various important files of your website:

<FilesMatch "^.*(error_log|wp-config\.php|php.ini|\.[hH][tT][aApP].*)$">
Order deny, allow
Deny from all


Learning to work with your WordPress site is quite important if you wish to become a WordPress expert. The .htaccess file is a good way to begin, since it’s a simple file and can be used for accomplishing a wide variety of tasks related to website management.

Also, before making any modifications to the .htaccess file, make sure to keep a backup of your site while using a staging environment. You can use FTP client for accessing the files of your website, find the .htaccess file and edit it.

People are also reading:

Leave a Comment