我遇到了以下问题:我每5分钟设置一次cronjob来执行我在public_html文件夹中的php脚本,并且每次尝试执行它时,我都会得到下一个(错误r发送到我的邮件):
Status: 302 Moved Temporarily
Set-Cookie: ava=sdasdasf1wfsadads; path=/
Expires: Thu, 19 Nov 1981 08:52:00 GMT
Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0
Pragma: no-cache
Location:http://localhost/myhostname.com/web/
Content-type: text/html; charset=UTF-8
我正在使用以下cmd作为cron作业:php /home/xxxx/public_html/_fnewsletter.php
另外,我想使用htaccess将每个用户重定向到页面的https://版本,并使用htaccess正确使用upgrade-insecure-requests
这是我的htaccess文件:
#Options +FollowSymLinks +ExecCGI
<IfModule mod_rewrite.c>
RewriteEngine On
# uncomment the following line, if you are having trouble
# getting no_script_name to work
#RewriteBase /
#RewriteCond %{REMOTE_ADDR} !^xxx\.xx\.xx\.xxx #ignore the xxx-s , its just an IP
#RewriteCond %{REQUEST_URI} !^/splash\.html$
#RewriteRule ^(.*)$ /splash.html [R=307,L]
# we skip all files with .something
#RewriteCond %{REQUEST_URI} \..+$
#RewriteCond %{REQUEST_URI} !\.html$
#RewriteRule .* - [L]
RewriteCond %{HTTP_HOST} !^www\.(.*)$ [NC]
RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]
# we check if the .html version is here (caching)
RewriteRule ^$ index.html [QSA]
RewriteRule ^([^.]+)$ $1.html [QSA]
RewriteCond %{REQUEST_FILENAME} !-f
# no, so we redirect to our front web controller
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>