.htaccess - 未找到 Ads.txt - 为 https 重定向正确配置 htaccess
问题描述
我试图让 Google 找到我的 ads.txt 文件。
目前我在尝试通过 HTTP 访问它时遇到问题(404 错误):
但是在 https 上它工作正常:
我认为我的 .htaccess 文件一定有问题,目前该文件内容如下:
RewriteEngine On
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^ https://leblonblue.com%{REQUEST_URI} [R=301,L,NE]
任何帮助将不胜感激
谢谢!
- 编辑
按照 CBroe 的建议,在其他内容之前放置重定向
RewriteEngine On
RewriteCond %{HTTPS} off [OR]
RewriteCond %{HTTP_HOST} ^www\. [NC]
RewriteRule ^ https://leblonblue.com%{REQUEST_URI} [R=301,L,NE]
RewriteBase /
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]
解决方案
正如 CBroe 建议的那样,问题实际上出在我的服务器配置上。
我从 htaccess 中删除了重定向规则,并修复了我的负载均衡器以正确路由 http。
推荐阅读
- django - 没有斜杠的 DRF 发布网址
- android - 通知未在 Android 8 上显示
- sql - 在同一 SELECT 语句中使用始终为 NULL、从不为 NULL、有时为 NULL 的列
- angular - Angular 5 / Jasmine 单元测试 - 无法读取未定义的属性“componentInstance”
- angular - Angular - 当通过表单 html 发布数据时给出空对象
- javascript - JavaScript 中的简单前馈神经网络
- android - 如何在 Android 中获取可用网络(GSM/LTE、WiFi 等)的列表
- python - 如何将日期时间转换为数字数据类型?
- ios - Xcode 10:iOS Team Provisioning Profile 不支持 $(TeamIdentifierPrefix)* Pass Type ID
- heroku - 如何在 Heroku 中部署和运行 clojurescript 应用程序