• Resolved casket21

    (@casket21)


    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.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support WFAdam

    (@wfadam)

    Hello @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

    (@casket21)

    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

    (@wfadam)

    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

    (@casket21)

    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.