Upgrade Your Drupal Skills

We trained 1,000+ Drupal Developers over the last decade.

See Advanced Courses NAH, I know Enough

Drupal cron.php restriction

Parent Feed: 

I recently made my first cron contrib module for Drupal, DB Maintenance. Since the DB Maintenance OPTIMIZE TABLE query locks the database tables it queries, I don't want just anyone to access cron.php anymore. The restriction I added was for the Apache .htaccess file that manages the clean URL rewrite rule.

<Files cron.php>
  Order deny,allow
  Allow from 207.7.108.211 127.0.0.1
  Deny from all
</Files>

207.7.108.211 is the current IP address of deekayen.net, which is needed instead of 127.0.0.1 when you run cron.php with lynx or wget as the documentation strongly suggests, which means 127.0.0.1 isn't the remote IP when Apache receives the request. I only put in 127.0.0.1 so in the future, if I need to access from localhost for some reason, I can.

Author: 
Original Post: 

About Drupal Sun

Drupal Sun is an Evolving Web project. It allows you to:

  • Do full-text search on all the articles in Drupal Planet (thanks to Apache Solr)
  • Facet based on tags, author, or feed
  • Flip through articles quickly (with j/k or arrow keys) to find what you're interested in
  • View the entire article text inline, or in the context of the site where it was created

See the blog post at Evolving Web

Evolving Web