【问题标题】:Ads.txt not found - properly configure htaccess for https redirection未找到 Ads.txt - 为 https 重定向正确配置 htaccess
【发布时间】:2020-12-24 20:47:51
【问题描述】:

我正在尝试让 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]

【问题讨论】:

  • 你应该在做其他事情之前做你的 HTTPS 重定向。
  • @CBroe,例如:RewriteEngine On RewriteCond %{HTTPS} off [OR] RewriteCond %{HTTP_HOST} ^www\。 [NC] RewriteRule ^ 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]
  • 请将其添加到您的问题中,格式正确,这在评论中难以阅读。
  • 你是对的,完成
  • 甚至 http://leblonblue.com 都不起作用,这已经给出了 404。看起来您的设置甚至没有将这种请求正确地路由到您的项目目录中?我猜这是您必须以某种方式在您的 Google 域设置中解决的问题。

标签: .htaccess https http-redirect


【解决方案1】:

正如 CBroe 所建议的,问题实际上出在我的服务器配置上。

我从 htaccess 中删除了重定向规则并修复了我的负载均衡器以正确路由 http。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2014-03-12
    • 1970-01-01
    • 1970-01-01
    • 2013-10-18
    • 2018-11-09
    • 2018-06-08
    • 2013-06-28
    • 1970-01-01
    相关资源
    最近更新 更多