Created
December 3, 2023 17:01
-
-
Save rserafim/1391e9c42876df44892e249328af96e8 to your computer and use it in GitHub Desktop.
Next Config redirects Bots
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const withPWA = require('next-pwa') | |
module.exports = withPWA({ | |
async redirects() { | |
return [ | |
{ | |
source: "/(.*)", | |
has: [ | |
{ | |
type: "header", | |
key: "User-Agent", | |
value: "(.*MJ12bot.*)" | |
} | |
], | |
destination: "/401", | |
permanent: false | |
}, | |
{ | |
source: "/(.*)", | |
has: [ | |
{ | |
type: "header", | |
key: "User-Agent", | |
value: "(.*DotBot.*)" | |
} | |
], | |
destination: "/401", | |
permanent: false | |
}, | |
{ | |
source: "/(.*)", | |
has: [ | |
{ | |
type: "header", | |
key: "User-Agent", | |
value: "(.*Linkbot.*)" | |
} | |
], | |
destination: "/401", | |
permanent: false | |
}, | |
{ | |
source: "/(.*)", | |
has: [ | |
{ | |
type: "header", | |
key: "User-Agent", | |
value: "(.*Iframely.*)" | |
} | |
], | |
destination: "/401", | |
permanent: false | |
}, | |
{ | |
source: "/(.*)", | |
has: [ | |
{ | |
type: "header", | |
key: "User-Agent", | |
value: "(.*AhrefsBot.*)" | |
} | |
], | |
destination: "/401", | |
permanent: false | |
}, | |
{ | |
source: "/(.*)", | |
has: [ | |
{ | |
type: "header", | |
key: "User-Agent", | |
value: "(.*PetalBot.*)" | |
} | |
], | |
destination: "/401", | |
permanent: false | |
}, | |
{ | |
source: "/(.*)", | |
has: [ | |
{ | |
type: "header", | |
key: "User-Agent", | |
value: "(.*BLEXBot.*)" | |
} | |
], | |
destination: "/401", | |
permanent: false | |
}, | |
{ | |
source: "/(.*)", | |
has: [ | |
{ | |
type: "header", | |
key: "User-Agent", | |
value: "(.*woorankreview.*)" | |
} | |
], | |
destination: "/401", | |
permanent: false | |
}, | |
{ | |
source: "/(.*)", | |
has: [ | |
{ | |
type: "header", | |
key: "User-Agent", | |
value: "(.*Barkrowler.*)" | |
} | |
], | |
destination: "/401", | |
permanent: false | |
}, | |
{ | |
source: "/(.*)", | |
has: [ | |
{ | |
type: "header", | |
key: "User-Agent", | |
value: "(.*Neevabot.*)" | |
} | |
], | |
destination: "/401", | |
permanent: false | |
}, | |
{ | |
source: "/(.*)", | |
has: [ | |
{ | |
type: "header", | |
key: "User-Agent", | |
value: "(.*SeoSiteCheckup.*)" | |
} | |
], | |
destination: "/401", | |
permanent: false | |
}, | |
{ | |
source: "/(.*)", | |
has: [ | |
{ | |
type: "header", | |
key: "User-Agent", | |
value: "(.*SemrushBot.*)" | |
} | |
], | |
destination: "/401", | |
permanent: false | |
}, | |
{ | |
source: "/(.*)", | |
has: [ | |
{ | |
type: "header", | |
key: "User-Agent", | |
value: "(.*RSiteAuditor.*)" | |
} | |
], | |
destination: "/401", | |
permanent: false | |
}, | |
{ | |
source: "/(.*)", | |
has: [ | |
{ | |
type: "header", | |
key: "User-Agent", | |
value: "(.*YandexBot.*)" | |
} | |
], | |
destination: "/401", | |
permanent: false | |
}, | |
{ | |
source: "/(.*)", | |
has: [ | |
{ | |
type: "header", | |
key: "User-Agent", | |
value: "(.*GrapeshotCrawler.*)" | |
} | |
], | |
destination: "/401", | |
permanent: false | |
}, | |
{ | |
source: "/(.*)", | |
has: [ | |
{ | |
type: "header", | |
key: "User-Agent", | |
value: "(.*proximic.*)" | |
} | |
], | |
destination: "/401", | |
permanent: false | |
}, | |
{ | |
source: "/wordpress", | |
destination: "/401", | |
permanent: true | |
}, | |
{ | |
source: "/wp-login.php", | |
destination: "/401", | |
permanent: true | |
}, | |
] | |
}, | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment