【问题标题】:How to setup stop a malicious website from forwarding to my website (my website is built on gatsby and hosted on netlify)如何设置阻止恶意网站转发到我的网站(我的网站建立在 gatsby 上并托管在 netlify 上)
【发布时间】:2020-04-03 03:58:02
【问题描述】:

我有一个恶意网站正在重定向到我的网站,我想阻止它。由于我的站点是建立在 gatsby 之上并托管在 netlify 上的,因此使用以下规则直接添加 .htaccess 文件是行不通的。

RewriteEngine on 
RewriteCond %{HTTP_HOST} maliciouswebsite1.com [NC,OR] 
RewriteCond %{HTTP_HOST} maliciouswebsite2.com
RewriteRule .* - [F] 

我尝试在 gatsby-config.js 中使用 gatsby-plugin-htaccess 和以下自定义规则,但它似乎也不起作用。关于如何实现这一目标的任何建议或想法?

{
      resolve: 'gatsby-plugin-htaccess',
      options: {
        custom: `RewriteEngine on 
           RewriteCond %{HTTP_HOST} maliciouswebsite1.com [NC,OR] 
           RewriteCond %{HTTP_HOST} maliciouswebsite2.com 
           RewriteRule .* - [F]`
      }
}

【问题讨论】:

    标签: redirect gatsby netlify


    【解决方案1】:

    .htaccess 语法与 Netlify 不兼容。他们有_redirects文件的概念。阅读更多关于它的信息here。此外,您可能会发现 gatsby-plugin-netlify 非常有用,因为它提供了用于设置重定向的 API 和使用 _redirects 文件的指南。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2015-10-13
      • 1970-01-01
      • 2022-01-12
      • 2016-02-13
      • 1970-01-01
      • 2019-10-21
      • 1970-01-01
      相关资源
      最近更新 更多