Millions of web hosting customers do not have an idea on htaccess, which is a basic file that every internet marketer and website founder should know about it. WordPress is a world’s popular Content Management System, which enables the beginners to start a website from scratch.
The htaccess file plays an important role in the websites and thousands of WP sites running on default htaccess. Majority of the readers/visitors already have excelled about the file here, but there are a few newbie’s that have zero knowledge in it.
Originally, the .htaccess file is hidden by default in file manager because the official developers of the Apache Server do not wish non-coders to access it. It is a core file that no one is willing to mess with it until or unless they have in-depth about it. It is a part of the root directory, which is the main reason for hidden status.
You can find the .htaccess file in Apache Web Server, and it isn’t a specific file available & found in WordPress website. It is a file that holds configuration of the server and the file assist the web server to function properly. Let us assume that you have opened a site, the web hosting server searches for the .htaccess files for the information and executes it.
Apache Web Server requires a set of the specific configuration so that it can function normally. In this case, the .htaccess file is serving configuration purpose on an Apache Web Server. For example, let us assume that there are a few websites, and its presence is uninvited, then you can block it via .htaccess file. For WordPress, it can hold settings for CMS security as well, which is an important factor nowadays. You can also utilize the .htaccess file for PHP redirect to URL so that you can redirect the old domain to new domain.
Before, we begin working on creating a default file; we should start looking for an existing hidden gem in the web hosting. I have already mentioned that .htaccess file is hidden somewhere in the file manager and you have to change the settings.
I assume that you have cPanel control panel credentials.
In the modern theme, you can find the search bar, and type File Manager and click on the first result.
A new window will open, then click on the PULIC_HTML and then click on SETTINGS.
A small window will pop-up on the screen. Select the (if you have multiple domains installed in one web hosting account) domain, then click on show hidden files then click on SAVE to confirm changes.
I have spotted .htaccess file in the PUBLIC_HTML folder, and you can find it in the selected domain folder as well.
That’s how you can view a hidden file in WordPress. You cannot change the default index page with the .htaccess file hidden.
WordPress is a CMS containing important files by default, and the .htaccess file is installed by default. Apache web server requires the file regardless of manual or automatic installation, and WP official is aware of it. I have shown the instructions regarding enabling hidden files in the File Manager. In some rare cases, we have cases, where the default is nowhere to be found, and it is a dead end indeed.
Most of us get tired of looking for a hassle in a stack, and there is a huge pile of files, folder, and unknown files installed in the web hosting file manager. Instead of looking for a default one, we can create a new one to replace the old one from the file manager.
Type file manager in the search bar and click on it to open it. In the next window, select public_html and then you can find the .htaccess file in it.
Select the file and then right-mouse click to view more options. There are a few options in it, but you have to click on edit.
A small window will pop-up on your screen and then click on Edit to continue.
Copy the codes below and paste it in the empty folder, then it should look something similar.
Click on save to make changes.
Fortunately, you can more than one .htaccess file in the root directory.
I have seen web hosting companies offering custom file manager, where you cannot find the .htaccess file in it. Contact the customer care for further information and the rest of the instructions remains the same. You don’t have to add a new line of codes because websites function using the same coding language. Let us know what do you think about creating a new .htaccess file in cPanel.