4 fixed error in the answer
source | link

If you want to protect the file you can restrict access to the file via your httpd.conf (global Apache config file).

# Wordpress wp-cron.php file
<Files wp"wp-cron.php>
  order Deny,Allowphp">
  denyRequire fromip all1.2.3.4
</Files>

ThisReplace the IP in the example with your server IP. This will still give you access to the file from 127.0.0.1 (and localhost). Andthe server using a command like:

wget -q -O - domain.com/wp-cron.php?doing_wp_cron

And it will return a 403 (access denied to the requesting partyrequests from any other IP). If you use an additional rule such as below you will redirect the 302 error returnexternal requests from 403 Forbidden to homepageanother page (which is unnecessary to block outside access to the filesuch as homepage): which isn't really necessary.

ErrorDocument 403 https://www.domain.ca/index.php

Even better, you can use Require ip 127.0.0.1 with the above example and use the wget request: wget -q -O - 127.0.0.1/wp-cron.php?doing_wp_cron. That will use the loopback network controller and your request will not be forwarded out into the public internet and back.

If you want to protect the file you can restrict access to the file via your httpd.conf (global Apache config file).

# Wordpress wp-cron.php file
<Files wp-cron.php>
  order Deny,Allow
  deny from all
</Files>

This will still give you access to the file from 127.0.0.1 (and localhost). And it will return a 403 (access denied to the requesting party). If you use an additional rule such as below you will redirect the 302 error return to homepage (which is unnecessary to block outside access to the file):

ErrorDocument 403 https://www.domain.ca/index.php

If you want to protect the file you can restrict access to the file via your httpd.conf (global Apache config file).

# Wordpress wp-cron.php file
<Files "wp-cron.php">
  Require ip 1.2.3.4
</Files>

Replace the IP in the example with your server IP. This will still give you access to the file from the server using a command like:

wget -q -O - domain.com/wp-cron.php?doing_wp_cron

And it will return a 403 (access denied to requests from any other IP). If you use an additional rule such as below you will redirect external requests from 403 Forbidden to another page (such as homepage) which isn't really necessary.

ErrorDocument 403 https://www.domain.ca

Even better, you can use Require ip 127.0.0.1 with the above example and use the wget request: wget -q -O - 127.0.0.1/wp-cron.php?doing_wp_cron. That will use the loopback network controller and your request will not be forwarded out into the public internet and back.

3 clarify the result of using the httpd.conf rule
source | link

If you want to protect the file you can restrict access to the file via your httpd.conf (global Apache config file).

# Wordpress wp-cron.php file
<Files wp-cron.php>
  order Deny,Allow
  deny from all
</Files>

This will still give you access to the file from 127.0.0.1 (and localhost). And it will return a 403 (access denied to the requesting party). If you use an additional rule such as below you will redirect the 302 error return to homepage (which is unnecessary to block outside access to the file):

ErrorDocument 403 https://www.domain.ca/index.php

If you want to protect the file you can restrict access to the file via your httpd.conf (global Apache config file).

# Wordpress wp-cron.php file
<Files wp-cron.php>
  order Deny,Allow
  deny from all
</Files>

If you want to protect the file you can restrict access to the file via your httpd.conf (global Apache config file).

# Wordpress wp-cron.php file
<Files wp-cron.php>
  order Deny,Allow
  deny from all
</Files>

This will still give you access to the file from 127.0.0.1 (and localhost). And it will return a 403 (access denied to the requesting party). If you use an additional rule such as below you will redirect the 302 error return to homepage (which is unnecessary to block outside access to the file):

ErrorDocument 403 https://www.domain.ca/index.php
2 added 20 characters in body
source | link

If you want to protect the file you can restrict access to the file via your httpd.conf (global Apache config file).

Wordpress wp-cron.php file

order Deny,Allow deny from all

# Wordpress wp-cron.php file
<Files wp-cron.php>
  order Deny,Allow
  deny from all
</Files>

If you want to protect the file you can restrict access to the file via your httpd.conf (global Apache config file).

Wordpress wp-cron.php file

order Deny,Allow deny from all

If you want to protect the file you can restrict access to the file via your httpd.conf (global Apache config file).

# Wordpress wp-cron.php file
<Files wp-cron.php>
  order Deny,Allow
  deny from all
</Files>
1
source | link