English
+370 5 205 5502 sales@monovm.com

What is WordPress Default .htaccess

Web servers running on the Apache Web Server software need the .htaccess configuration file to run. You can adjust your website on an Apache server using your WordPress .htaccess file. Read along to learn more!

21 Mar, 22 by Susith Nonis 6 min Read

List of content you will read in this article:

Web servers running on the Apache Web Server software need the .htaccess configuration file to run. The .htaccess file is loaded through the Apache Web Server after being placed in a directory. After loading, the .htaccess file is executed by the Apache Web Server software.

What does this mean? The files can be adjusted to the configurations of the Apache server software. This way, the user can enable or disable the Web Server software's features and functionalities. 

In WordPress, .htaccess controls how your server runs your site. .htaccess is one of the most powerful configuration files capable of controlling SSL connections, password protection, 301 redirects, and your default language, to mention a few.

In essence, the file offers commands for configuring and controlling the Apache Web Server. Note that the Apache Web Server hosts thousands of server farms or websites. If the configuration site were not there, all the websites would have the same settings. 

With the file, you can build a unique WordPress website through the configuration of different settings, force SSL, control access to sensitive files, block IP addresses, send custom HTTP responses on certain requests, and prevent hotlinking.

To find the .htaccess configuration file, you need to open your WordPress site's root directory. The name of your root directory could be httpdocs, htdocs, www, or public HTML, depending on your hosting provider. 

You can also locate .htaccess through your account's cPanel. Here are the steps:

  1. Open your file manager
  2. On the left side of your screen, open the public HTML folder
  3. Under the HTML folder, open the "WordPress" folder
  4. Search for .htaccess file within the WordPress folder

If you cannot locate the .htaccess file, it means it does not exist. The good thing is that you can create it.

By default, your WordPress site will use .htaccess to enable and disable features on Apache, operate caching and security plugins, and manage redirects and permalink structures.

The .htaccess file makes it possible for you to make both basic and advanced configuration changes. That could be what would be considered simple changes like changing the time zone of your website to advanced configurations like rewriting URLs, setting up redirects, customizing error pages, and password protection.

To access the WordPress default .htaccess page, follow the procedure highlighted above. Sometimes, WordPress will not automatically create the .htaccess files for you. In this case, you are required to do it manually. Here are the steps.

  1. Go to your WordPress dashboard, select "Settings", then click on "Permalinks".
  2. Scroll to the bottom of the page and save the changes. However, remember that you should not make any changes to the permalinks.
  3. Once you save the changes, WordPress will generate the configuration file. If it is unable to, you will get feedback that the file is not writeable. This is a cue to create the configuration file.
  4. Create the .htaccess file by first opening the file manager. Open the public HTML folder on the left side of the screen and click on the "File" icon.
  5. In the field provided, type in ".htaccess" then click "Create New File."
  6. Edit the newly created file and add the code below

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

  1. Once done, save and close the file.

Now that you know how to create a .htaccess file on WordPress, the next thing to learn is how to edit the file. You can edit the .htaccess file to override the setting or configurations in your web server. There are three methods for editing WordPress .htaccess.

You can edit it from cPanel, using FTP clients or a plugin.

Editing .htaccess File From cPanel

  1. Navigate to the File Manager

To access the file manager, log into your hosting account, and open cPanel. Under it, choose File Manager.

  1. Select the public HTML folder

Under the File Manager, select the public HTML folder. Search for the .htaccess file in the folder and right-click.

  1. Select edit

Click edit, then insert your modifications.

Editing Using FTP Clients

You can edit the .htaccess configuration using an FTP client. The FTP client allows you to access your website from a local computer.

You have to install the FTP client and connect the software to your website. Once connected, locate the .htaccess from your local computer. Depending on the FTP client you use, you will mostly find the file from the "remote site" option.

From the remote site:

  1. Open public HTML

Under remote site, search for the public HTML folder. Under this folder, find the .htaccess file and right-click.

  1. Click edit

Click edit and make modifications.

Editing Using a Plugin

Using a plugin for editing is a good option for the web owner looking for a simpler process and is afraid to make mistakes on their website files. First, ensure that the plugin you have selected is compatible with your website, lest it will cause your website issues.

Once you install the plugin, go back to your website's dashboard and select settings options. Under settings, select the plugin, and often, you will be prompted directly to the .htaccess file. You can then make modifications to the code and save your changes.

You can adjust your website on an Apache server using your WordPress .htaccess file. To make the modifications, however, you have to locate the configuration file. One of the ways to locate your .htaccess is through your account's cPanel.

In some cases, you may not locate the file, which indicates that the file does not exist and you have to create it. To control your website on Apache Web Server, whether it is managing passwords, setting up redirects, or rewriting URLs, you need to know how to access and edit the configuration file.

The guides above will help you locate the .htaccess file and edit it to make configurations.

People also read:

Susith Nonis

I'm fascinated by the IT world and how the 1's and 0's work. While I veture into the world of Technology I try to share what I know in the simplest way possible. Not a fan of coffee, a sweet addict and a self accredited 'master chef'.