8

I get many of these errors each day in my apache error log:

[error] [client 127.0.0.1] script '/var/www/html/wp-cron.php' not found or unable to stat

and I'm wondering if it has something to with my httpd.conf, because my DocumentRoot is set as "/var/www/html" but my WordPress site(s) are in a top directory called httpdocs, not html. wp-cron.php exists, but it's in httpdocs, not html, and there is no html directory. There are multiple WordPress sites and domains on the VPS and at the IP.

There are no other errors like that in the logs, and WordPress seems to run fine. But I want to fix these errors, as it's a bit of an extra load on the server.

Is there a way to add a redirect or alias in httpd.conf so wp-cron.php can be found? Or this a different matter with a different solution?

Edit: Found the answer; problem was hosts file entries: Hosts file entries for multiple domains on VPS?

markratledge
  • 499
  • 5
  • 13
  • 24

2 Answers2

6

The DocumentRoot in httpd.conf is likely to be the default for any hosts not handled by a virtual host. For example, requests on the IP address.

You could set the DocumentRoot to be the same as the default site (if that's what you want for requests to the IP address), or you use a RewriteRule to rewrite the request back to the main site either in the httpd.conf or in the .htaccess file:

<Directory /var/www/html>  
    RewriteRule wp-cron.php http://yourdomainname.com/wp-cron.php [R=301]  
</Directory>

Without knowing what the script is, or if it exists elsewhere, it's not easy to advise. A symlink could also fix it, but permissions might get in your way.

hjpotter92
  • 660
  • 1
  • 10
  • 20
James L
  • 5,915
  • 1
  • 19
  • 24
  • That makes sense. The file does exist, except it's in httpdocs, not html. And there are multiple installs of Wordpress under different domains, so I think they are all calling wp-cron.php at different times. So should I add that 301 redirect to each .htaccess in each Wordpress directory? – markratledge Sep 22 '10 at 20:03
  • It would be more useful to determine why it's being called every day, and then fix the source. However, if you can't do that, just a 301 redirect in the /var/www/html should suffice. – James L Sep 23 '10 at 11:42
  • It's Wordpress; that cron call happens at least every few hours. But I don't have a html directory, so I suppose I could make one and put a 301 redirect there in an .htaccess file? – markratledge Sep 27 '10 at 20:49
  • If you don't have a /var/www/html, you need to fix your default documentroot so it's not pointing there. – James L Sep 28 '10 at 08:47
  • Little hesitant to change the doc root and possibly take everything down. What should my etc/hosts file look like? There are multiple sites on the one IP, and the main site in particular isn't listed in hosts. – markratledge Sep 28 '10 at 22:50
4

Found the answer; problem was hosts entries: Hosts file entries for multiple domains on VPS?

markratledge
  • 499
  • 5
  • 13
  • 24