Title: Siteground optimize firewall
Last modified: February 4, 2021

---

# Siteground optimize firewall

 *  Resolved [casket21](https://wordpress.org/support/users/casket21/)
 * (@casket21)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/siteground-optimize-firewall/)
 * Hi I’ve got a website hosted on siteground and under it a number of sub domain
   sites. I have wordfence set up on all sites and followed the advice for optimizing
   the firewall on siteground ticking the apply to all subdirectories. Wordfence
   works fine on my main site but not for any of the sub directories. I’ve asked
   Siteground but they say add more auto prepend files which it won’t let me do.
   I’ve no idea how to do this now. All advice on how to fix this for my sub domains
   would be much appreciated.
    -  This topic was modified 5 years, 4 months ago by [casket21](https://wordpress.org/support/users/casket21/).

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Support [WFAdam](https://wordpress.org/support/users/wfadam/)
 * (@wfadam)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/siteground-optimize-firewall/#post-14016542)
 * Hello [@casket21](https://wordpress.org/support/users/casket21/) and thanks for
   reaching out to us!
 * You should be able to set all subdirectories auto_prepend_file at the same time
   using Sitegrounds cPanel.
 * On SiteGround — go to your cPanel and go to PHP Variables Manager. Click the 
   subfolder that your current WordPress site is located in there. If it is in public_html,
   click that. You will then see a field where you can enter a variable. Enter: 
   auto_prepend_file there and click add. You will see a new field come up for auto_prepend_file
   where you can enter a path. We will return here in a second.
 * In a new tab, go back to your site and goto Wordfence > Firewall > All Firewall
   Options. Click the Optimize the Wordfence Firewall and then click the dropdown
   box and select Manual Configuration at the bottom, then continue. You will then
   see something similar to this:
 * `auto_prepend_file = '/home/sitename/public_html/subfolder/wordfence-waf.php'`
 * Just copy the path inside the ‘ ‘ symbols, in my case, /home/sitename/public_html/
   subfolder/wordfence-waf.php
 * Go back to your PHP Variables Managers tab and paste that path (/home/sitename/
   public_html/subfolder/wordfence-waf.php) into the auto_prepend_file field and
   click the checkbox for Apply changes to all subdirectories? and click Save. Make
   sure the confirmation screen has no errors, then go back to your site and refresh
   it. You should be at 100%.
 * Let me know if this helps or if you have any questions!
 * Thanks!
 *  Thread Starter [casket21](https://wordpress.org/support/users/casket21/)
 * (@casket21)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/siteground-optimize-firewall/#post-14017842)
 * Thank you for coming back to me. I have done this for the main site already which
   worked perfectly. Do I I have add each sub domain individually? I assumed that
   if I clicked the checkbox for apply to all subdirectories that this would work?
   It hasn’t so I guess I do have to add each one? Thanks again – your assistance
   is much appreciated.
 *  Plugin Support [WFAdam](https://wordpress.org/support/users/wfadam/)
 * (@wfadam)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/siteground-optimize-firewall/#post-14019840)
 * If that didnt work properly, you might have to follow this guide:
 * If you have multiple sites on a single hosting account and need to use php.ini
   as described in the previous section, you may need to add a similar php.ini file
   in each individual site’s subdirectory. In this case, you may also need to add
   code like this in each additional site’s .htaccess file, to tell PHP which php.
   ini file to use:
 * `SetEnv PHPRC /home/user/public_html/sitename/php.ini`
 * You will need to adjust the path for your site and the site’s directory name 
   before adding this to the .htaccess file. If the subdirectory site’s .htaccess
   file already has a similar line, this change may not be needed. Note: Some hosts
   may require PHPRC to show the path without “php.ini” at the end.
 * Let me know if this helps!
 *  Thread Starter [casket21](https://wordpress.org/support/users/casket21/)
 * (@casket21)
 * [5 years, 4 months ago](https://wordpress.org/support/topic/siteground-optimize-firewall/#post-14020969)
 * Thank you – I added it to the subdomain and it seems to have worked. Thank you
   so much for your help – it was much appreciated 🙂

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Siteground optimize firewall’ is closed to new replies.

 * ![](https://ps.w.org/wordfence/assets/icon.svg?rev=2070865)
 * [Wordfence Security - Firewall, Malware Scan, and Login Security](https://wordpress.org/plugins/wordfence/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wordfence/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wordfence/)
 * [Active Topics](https://wordpress.org/support/plugin/wordfence/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wordfence/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wordfence/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [casket21](https://wordpress.org/support/users/casket21/)
 * Last activity: [5 years, 4 months ago](https://wordpress.org/support/topic/siteground-optimize-firewall/#post-14020969)
 * Status: resolved