htaccess

How to Edit .htaccess File in the cPanel File Manager

Log in to your cPanel account. In the Files section, click on File Manager. Navigate to the directory where your dot htaccess file is located. To edit the .htaccess file of your root directory, navigate to the public_html directory. If the dot htaccess file does not show, click on Settings in the File Manager. You can find the Settings button on the right side of the top menu. Mark the Show Hidden Files (Dotfiles) option in the new window box and click on Save. Now, the dot htaccess file should be present. If it does not exist, create a new one. Right-click on the dot htaccess file and then Edit in the Context Menu. In a new window box, click on Edit. Make changes to your dot htaccess file and click on Save Changes.

Related: htaccess


August 28, 2023

How to Block Any IP Address via an htaccess Rule

If you want to block an IP Address, you can add the below lines to your htaccess file. order allow, deny deny from IP-ADDRESS allow from all Replace IP-ADDRESS with the IP you want to block.

Related: htaccess


August 28, 2023

How to Protect Your htaccess File

You can prevent unauthorized access to your htaccess file by adding this rule to the file: # .htaccess protection order allow, deny deny from all satisfy all

Related: htaccess


August 28, 2023

Fix PHP Error: Allowed Memory Size of X Bytes Exhausted

If you encounter an error like “Allowed memory size of… in file /directory/folder/yourscript.php“, consider using an .htaccess file to address the issue. Should the error persist even after implementing the .htaccess solution, please reach out to us. We’re committed to assisting you. Insert the following code into the .htaccess file at the root of your main domain. If the issue remains unresolved, place the code in the specific directory where the error appears, for instance, example.com/directory/folder/.htaccess. Incorporate this line into your .htaccess file: RLimitMem max

Related: error, htaccess


July 4, 2023

How to Ban Any IP Address via htaccess

To prohibit an IP Address from accessing your site, incorporate the following lines into your .htaccess file: order permit, reject deny from IP-ADDRESS allow from everyone Substitute IP-ADDRESS with the specific IP you aim to block.

Related: htaccess


April 19, 2023