Need to Change .htaccess: How to Locate One with a Fresh WP Installation?

Blog, Tutorials No Comments

Among the most puzzling but common WordPress errors related with the WordPress site, sudden disappearance of the .htaccess file has baffled many users. Recently we advised a user to delete the .htaccess file from his website but upon searching that user was unable to locate the .htaccess file and presumed his website was malfunctioning. Such subtle errors create huge confusion and panic in the mind of beginners. So do not worry, in this article we will discuss about why you cannot find the .htaccess file on your WordPress site and how to create one if needed.

What is .htaccess file?

.htaccess file is mainly a configuration file. This distributed configuration file helps WordPress to manipulate how Apache web server handles files from its root directories, sub-directories and handling permalinks. In simple words this server configuration file directs your server how to handle certain jobs like redirect users, Password protect the admin area, protect some directories, etc. The file name .htaccess indicates hypertext access and the ‘.’ before the file name indicates it in a hidden file.

If you are accessing your server through FTP you will be unable to see the .htaccess file unless you force FTP client to show hidden files. But, sometimes even after forcing the FTP client to show the hidden files, the .htaccess file does not appear.

Why .htaccess file can’t be found?

The root cause and solution for this error can be multi-folded and we must look into different aspects of how WordPress handles the .htaccess file.

One of the most common reasons due to which .htaccess file cannot be found is that your WordPress site has not yet generated the .htaccess file. During the setting of pretty permalinks, the WordPress generates the .htaccess file for the first time. Pretty permalinks can be set from Settings » Permalinks. After accessing the Permalink screen all you have to do is to click on the Save changes button on the screen and WordPress will automatically create an .htaccess file under the root directory of your website.

But, sometimes and mostly on rare occasion, WordPress may not be able to generate the .htaccess file. This failure is mainly due to the file permission issues. WordPress will display a notice at the bottom of the Settings » Permalinks screen indicating that the .htaccess file is not writable. If you have modified permalinks to use any setting other than the default one then it will also show you the code that is required to be pasted in the .htaccess file.

All you need to do is to copy and paste this code in a text editor like Notepad. After creating the file you need to save it as .htaccess file in your desktop or any other location. Then connect to your website using an FTP client and upload .htaccess file from your desktop.

The file permission for your root directory must be changed in case you get an error while uploading the file.

Let us consider all your WordPress files are placed under ——- /home/xxxyyyzzz/public_html/ directory.

  • This constructs public_html folder your root directory.
  • Go to its parent directory and right click on the public_html folder.
  • Select File Permissions, which will open file permissions dialog box.
  • Enter 755 into the file permission dialog box.
  • Attempt to upload your .htaccess file to public_html folder.

So we hope that this article will help you to find or generate .htaccess file on your WordPress website. It must also be mentioned that this is a very important file and mishandling or misplacing this might disturb the normal operation of your website.

If you are an amateur and just starting out with WordPress don’t forget to check out our Beginners Guides section. It has simplebut lucrative tutorials specifically written for new WordPress users. Kindly post your feedback and queries in the comment below in order to inform us.

 

Author Bio

Lucy Berrett is working full time with WPGeeks Ltd as a Sr. WordPress Consultant. Playing a vital role with every wordpress website development project and leading her team to successful deliveries of project. Creative in nature Lucy loves to write about WordPress and related topics to contribute to this largest community.

We really appreciate you for visiting PremiumCoding and reading this article! Now you might also want to check out our Themes here.