Call Us: +90 850 532 5 260 Submit Ticket   Login
WordPress Original .htaccess File and Code

WordPress Original .htaccess File and Code

WordPress .htaccess File

WordPress website structure is generally called content management system, or CMS. WordPress, one of the most popular blog applications today, has gained a considerable reputation in the internet community thanks to its many advantageous features.

In this article, we will see what the .htaccess file is and what it does, which is found in WordPress as well as other website software.

 

What is Htaccsess?

.htaccess is actually a file that is not very visible. It is usually located in the root directory of your website. It is also not a file specific to WordPress systems. It can be placed in the root directory for all websites using Apache servers.

Htaccess, a configuration file for the server, is searched and found when the web server starts. It is then executed.

In fact, the purpose of the .htaccess file is to reconfigure certain settings of Apache servers. Or it can be said that it also serves to turn some settings on and off.

While it generally has the function of redirecting non-www extensions to www and vice versa, it also allows for many different functions such as blocking bots, adding MIME types and security settings.

 

Creating a Default .Htaccess File for WordPress

When you install WordPress on your Apache server, the .htaccess file will be loaded automatically. However, since it is hidden, you need to 'Make Hidden Files Visible'. However, sometimes for some reason the .htaccess file may not be loaded or may have been deleted. Then you will need to create this file manually.

 

 

To create a .htaccess file manually;

 

  • You need to connect to the root directory of your site, either from Cpanel or FTP.
  • Then create a text file named .htaccess
  • Add the following default Htaccess code to the text file

If you are using a normal WordPress blog or site, the htaccess code below will be sufficient for you.

 

# BEGIN WordPress
RewriteRule ^index\.php$ – [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
# END WordPress

 

  • After adding the code, save and exit and check the file.

 

If you are using WordPress MultiSite as a Subfile, you will need to apply the following codes;

 

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule .index.php [L]

Or if you are using MultiSite as a subdomain, you can apply the codes below.

 

RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
# add a trailing slash to /wp-admin
RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]
RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
RewriteRule ^(.*\.php)$ $1 [L]
RewriteRule .index.php [L]

 

If you do not know how to edit a file, you can download it now from below and upload it with FTP or File Manager.

To Download Here You can click.

See you in our next article 🙂

About the Author

Leave a Reply

en_US