Fix 301: Moved Permanently error when running cronjob