Setting up a custom .htaccess file
You can use directives in an .htaccess file to control many PHP settings. Additionally, you can set up one or multiple custom .htaccess files to define how your web site functions. For example, you might have a custom file in your public_html directory for your web site’s main pages, and a separate custom file in your public_html/images directory for your web site’s image files. To set up a custom .htaccess file, follow these steps:- Log in to your account using SSH.
-
Use a text editor to create an .htaccess file in your web site’s document root directory.
📘 Note Alternatively, if you want to set PHP settings for a specific subdirectory, create the .htaccess file in that subdirectory.
-
For security reasons, the .htaccess file contents should not be visible to the public. To do this, add the following lines to the .htaccess file:
- Save the changes and exit the text editor. You are now ready to add specific PHP directives to the .htaccess file. For more information about how do this, please see these articles.