Redirects limit

PLEASE help us help you by writing a good post!

Hello,

We have contentful and want to move all of our blog posts from our sites root directory to the /blog/ directory. We have about 358 post pages that need to be redirected.

Will our redirects file be able to process this amount? Currently we have about 175 lines in our redirect file.

Do you see any other way to redirect this content? We also have our main site pages at the root which are probably in the amount of 100+ pages and we plan to keep these where they are at.

Thank you!

Could you give an example of the type of redirect you want to do?

By default (without force) only pages that does not exist are redirected, so something like below could work depending on exactly what you want to do:
/* /blog/:splat 200

@snorkypie first thanks for the reply.

Our website livelyme .com has all of our blog posts in the livelyme .com root directory:

  • /8-financial-discussions-to-have-before-marriage
  • /average-cost-of-health-insurance-for-a-married-couple
  • /get-the-most-out-of-your-401k
  • /lose-your-job-here-is-what-to-know-about-your-health-insurance-options
  • /understanding-financial-independence
  • /long-term-care-hsa
  • /5-best-financial-decisions-in-your-60s
  • /5-best-financial-decisions-in-your-40s
  • /taxes-in-your-30s
  • /automated-health-savings
  • /investing-your-hsa-using-compound-growth-to-your-advantage
  • /health-insurance-for-freelancers
  • /can-i-invest-my-hsa-funds
  • /just-signed-up-health-insurance
  • /hsa-transfer-vs-rollover
  • /hsa-excess-contribution
  • /flexible-spending-account-fsa-rollover
  • /rolling-over-your-hsa
  • /hsa-account-guidelines
  • /hsa-contribution-limits-mid-year-changes
  • /5-best-financial-decisions-in-your-20s
  • /high-deductibles-enemy
  • /what-is-an-hsa
  • /hsa-investment-strategies
  • /hsa-ios-app
  • /real-health-insurance-cost
  • /can-i-open-an-hsa-for-my-child
  • /hsa-medical-debt
  • /individual-hsa
  • /how-does-a-health-savings-account-hsa-work
  • /hsa-debit-card
  • /how-to-invest-your-hsa-money
  • /hsa-eligibility-requirements
  • /are-my-hsa-funds-safe-in-an-investment-account
  • /individual-health-insurance
  • /a-health-savings-account-is-not-your-health-insurance
  • /millennial-hsa
  • /top-hsa-provider
  • /prorated-hsa-contributions
  • /midyear-benefits-changes
  • /android-mobile-app
  • /hsas-for-freelancers
  • /2019-hsa-guidebook
  • /can-i-invest-my-hsa-money
  • /open-hsa-outside-open-enrollment
  • /2021-hsa-contribution-limits
  • /comparing-the-hsa-to-the-fsa
  • /5-best-financial-decisions-in-your-50s
  • /5-best-financial-decisions-in-your-30s
  • /the-cost-of-knee-replacement-surgery
  • /the-cost-of-breast-cancer
  • /the-cost-of-childbirth
  • /hip-replacement-cost
  • /the-costs-of-bypass-surgery
  • /401k-vs-hsa
  • /set-forget-hsa
  • /tax-free-retirement-income
  • /hsa-spending-vs-investing
  • /hra-vs-hsa
  • /healthcare-retirement-costs
  • /2018-hsa-contributions
  • /substantiate-fsa
  • /what-can-you-buy-with-your-hsa
  • /summer-hsa-expenses
  • /should-i-get-an-fsa
  • /hsas-and-retirement
  • /hsa-catch-up-contributions
  • /fsa-vs-hra
  • /fsa-benefits
  • /common-retirement-mistakes
  • /can-freelancers-open-an-hsa
  • /how-to-avoid-debit-card-fees
  • /hsa-if-you-are-over-55
  • /taxes-in-your-40s
  • /average-cost-of-health-insurance-for-single-women
  • /i-broke-my-elbow-but-not-my-bank-account-because-of-my-hsa
  • /how-to-rollover-your-hsa-funds
  • /what-does-it-mean-to-reimburse-myself-with-my-hsa
  • /3-types-of-flexible-spending-accounts-fsa
  • /self-employed-retirement-tips
  • /what-is-hsa
  • /hsa-reimbursement-rules
  • /what-happens-to-my-hsa-when-i-die
  • /difference-between-hsa-fsa
  • /flexible-spending-account-fsa-eligible-items
  • /family-hsa-vs-individual
  • /dependent-care-fsa-dcfsa-work
  • /contribute-HSA-after-retirement
  • /common-health-care-expenses-pink-eye
  • /divide-hsa-during-divorce
  • /who-can-use-hsa
  • /stay-on-partners-insurance-after-divorce
  • /important-benefits-applying-jobs
  • /strategies-investing-hsa
  • /fsa-hsa-at-home-wellness
  • /common-healthcare-expenses-braces
  • /file-taxes-first-time
  • /forms-tax-return
  • /cost-plantar-fasciitis
  • /fsa-hsa-help-seasonal-allergies
  • /file-quarterly-taxes-freelancer
  • /cost-laser-eye-surgery
  • /mental-health-benefits-uncertain-times
  • /what-happens-healthcare-unemployed
  • /w-2-tax-form
  • /maxing-out-2019-contributions
  • /choose-first-health-insurance-plan
  • /choose-health-insurance-domestic-partnership
  • /average-health-insurance-costs-newly-married-couple
  • /2019-hsa-contribution-tax-deadline-extended
  • /how-to-choose-a-health-insurance-plan-as-a-single-parent
  • /what-causes-healthcare-costs-to-rise
  • /how-to-choose-health-insurance-when-nearing-retirement
  • /life-events-that-can-change-your-healthcare-costs
  • /best-healthcare-tax-return
  • /4-tools-to-help-you-calculate-healthcare-costs
  • /how-to-choose-the-best-health-insurance-for-your-children
  • /reduce-your-self-employment-taxes-with-an-hsa
  • /how-to-use-your-hsa-as-a-retirement-account
  • /short-term-benefits-of-a-health-savings-account-hsa
  • /should-i-use-my-hsa-to-save-money-or-spend-it
  • /hsas-and-retirement-what-you-need-to-know
  • /i-just-turned-65-how-does-that-affect-my-hsa
  • /is-coronavirus-testing-covered-by-my-high-deductible-health-plan
  • /medicare-and-hsas-what-you-need-to-know
  • /long-term-benefits-of-using-an-hsa
  • /is-my-hsa-tax-deductible
  • /what-is-tax-form-8889
  • /what-is-tax-form-1099-sa
  • /ira-to-hsa-the-benefits-of-a-one-time-transfer
  • /understanding-retirement-savings-accounts
  • /new-hsa-owners-guide
  • /what-is-tax-form-5329
  • /maxing-out-which-retirement-account-should-i-max-out-first
  • /hsa-eligibility-details
  • /hra-vs-msa-whats-the-difference
  • /trustee-to-trustee-transfer-vs-direct-rollover
  • /what-is-tax-form-5498
  • /what-is-an-hsa-catch-up-contribution
  • /can-i-still-make-a-2019-hsa-contribution
  • /hsa-vs-msa-whats-the-difference
  • /how-you-can-use-your-ira-to-fund-your-hsa
  • /2020-money-resolutions-building-an-emergency-fund
  • /how-does-a-health-savings-account-affect-my-taxes
  • /how-much-money-do-i-actually-need-to-retire
  • /how-to-take-advantage-of-a-health-savings-account-deduction
  • /2020-money-resolutions-paying-off-debt
  • /no-longer-eligible-for-hsa
  • /compounding-interest-and-retirement-how-starting-early-pays-off-later
  • /how-to-evaluate-a-companys-benefits
  • /can-i-use-my-hsa-for-a-friend
  • /how-much-should-i-put-in-my-hsa
  • /can-i-use-my-hsa-for-my-spouse
  • /can-i-use-my-hsa-for-my-child
  • /guide-to-hsa-withdrawals
  • /lively-free-hsa-account-voted-top-hsa-provider-by-morningstar
  • /last-month-rule
  • /what-should-i-do-if-i-contribute-too-much-to-my-hsa
  • /investing-vs-saving-what-is-the-smarter-strategy-for-hsas
  • /investing-101-key-terms-you-should-know
  • /how-does-getting-married-affect-my-hsa
  • /what-is-open-enrollment-and-how-does-it-affect-me
  • /when-should-i-consider-changing-my-health-plan
  • /changes-to-hsa-eligible-hdhps-for-chronic-conditions
  • /what-is-the-october-effect
  • /why-an-hsa-with-a-debit-card-is-better-than-an-hsa-without-one
  • /budgeting-plan-for-families
  • /is-hsa-health-insurance
  • /budgeting-plan-for-retirees
  • /hsa-contribution-guide
  • /tips-for-enrolling-in-medicare
  • /health-insurance-considerations-to-plan-for-when-adopting-a-child
  • /healthcare-options-for-seniors
  • /expense-scout
  • /add-1-hsa-day-1
  • /tips-to-reduce-your-healthcare-spending
  • /is-23andme-eligible-for-fsa-hsa-reimbursement
  • /hsas-for-summer-expenses
  • /how-to-use-an-ichra-with-an-hsa-and-a-hdhp
  • /taxes-in-your-50s
  • /health-insurance-deductible-spending
  • /taxes-in-your-20s
  • /how-old-is-too-old-to-start-an-hsa
  • /tax-checklist-2019
  • /are-hsas-tax-smart-investing
  • /2019-tax-checklist-the-ultimate-guide-to-a-pain-free-return
  • /tips-for-hdhp
  • /2020-hsa-contribution-limits
  • /10-retirement-lessons
  • /employer-benefits-increase-wealth
  • /health-insurance-overview-for-freelancers
  • /hsa-for-wealth-building
  • /overview-of-self-directed-hsa
  • /hsas-for-retirement
  • /how-can-you-reduce-taxes-on-your-investments
  • /benefits-no-fee-hsa
  • /3-answers-to-common-tax-questions
  • /hra-rules
  • /how-does-a-health-reimbursement-account-work
  • /deduct-health-insurance-premiums-self-employed
  • /how-to-pay-taxes-when-youre-self-employed
  • /fsa-rules
  • /average-cost-of-health-insurance-for-a-family
  • /average-cost-of-health-insurance-for-single-men
  • /how-to-maximize-savings
  • /self-employed-hsa-options
  • /irs-tax-form-8889
  • /what-is-irs-tax-form-1099-sa
  • /what-happens-to-my-hsa-if-i-die
  • /how-to-make-the-best-choices-during-open-enrollment
  • /no-fee-hsa
  • /employee-benefits-package-example
  • /employee-benefits-questions-to-ask-during-open-enrollment
  • /how-hsa-tax-deductions-work
  • /health-plan-comparison-calculator
  • /the-ultimate-hsa-tax-form-checklist
  • /what-medicare-part-b-covers
  • /can-an-hmo-be-an-hdhp
  • /how-does-your-hsa-impact-your-tax-returns
  • /what-hsa-tax-forms-do-you-need-to-fill-we-know
  • /hmo-vs-hdhp
  • /can-an-hdhp-be-a-ppo
  • /health-insurance-basics
  • /out-of-pocket-vs-deductible
  • /health-insurance-open-enrollment-2019
  • /hdhp-vs-ppo
  • /alternate-employer-hsa
  • /expected-hdhp-costs
  • /hra-value
  • /hra-benefits
  • /hsa-growth-infographic
  • /employee-healthcare-guide
  • /fsa-hacks
  • /2019-open-enrollment-details
  • /self-employed-health-insurance
  • /medicare-enrollment-details
  • /what-is-open-enrollment
  • /fsa-eligible
  • /where-purchase-fsa-eligible-items
  • /hsa-funds-investments
  • /prepare-for-open-enrollment
  • /universal-hsa
  • /moving-health-insurance-plans
  • /hsa-eligibility-calculator
  • /2019-hsa-contribution-limits
  • /hsa-investment-maximum
  • /employee-retirement-benefits
  • /employee-hsa-guide
  • /irs-revises-2018-contribution-limit
  • /calculate-max-hsa-contributions-mid-year-change
  • /medicare-hsa
  • /fsa-rollover-versus-grace-period
  • /how-to-approach-an-hsa
  • /where-to-get-a-health-savings-account
  • /hsa-pitfalls
  • /hsas-buy-and-hold-proposition
  • /what-is-the-cost-of-an-hsa
  • /can-i-still-make-a-2017-hsa-contribution
  • /hsas-and-healthcare
  • /hsa-quick-start-guide
  • /long-term-value-hsa
  • /2019-and-2018-hsa-contribution-limits
  • /hsa-vs-ppo
  • /short-term-hsa-value
  • /2018-contribution-irs-revision
  • /what-is-a-limited-purpose-fsa
  • /stealth-ira
  • /first-dollar-investing
  • /hsa-spend-save-invest
  • /hsa-tax-form-check-list
  • /how-to-establish-an-hsa
  • /hsa-fsa-for-travel-expenses
  • /how-does-an-fsa-work
  • /differences-between-hsa-vs-healthcare-fsa-infographic
  • /what-is-an-hra
  • /what-are-the-benefits-of-an-health-savings-account
  • /what-is-an-fsa
  • /hsas-vs-fsas
  • /flexible-spending-account-rules
  • /what-is-a-healthcare-fsa
  • /things-to-consider-when-investing-your-hsa
  • /self-direct-hsa-investments
  • /hsa-investment-fees
  • /hsa-taxes
  • /how-does-a-health-savings-account-work
  • /what-is-a-dependent-care-fsa
  • /health-insurance-key-words-that-you-should-know
  • /open-enrollment-tips-for-employees
  • /employer-lets-pick-hsa-provider
  • /is-fsa-worth-it-flexible-spending-account
  • /what-is-a-high-deductible-health-plan-hdhp
  • /what-are-the-benefits-of-an-fsa
  • /open-enrollment-jargon
  • /lively-raises-4-2m-and-announces-arrival-of-hsa-investments
  • /hdhp-value
  • /guaranteed-hsa-growth
  • /healthcare-tax-shield
  • /401k-hsa-perfect-match
  • /hsa-hack-emergency-savings
  • /know-hsas-taxes
  • /health-plan-options-increase-2018
  • /fdic-insured-hsa
  • /1-tip-to-save-money-on-healthcare
  • /young-healthy-with-hsa
  • /hsa-tax-return
  • /non-dependent-hsa
  • /maximize-tax-savings
  • /hsa-money-year-end
  • /family-hsa-contributions
  • /hsa-rollovers-transfers
  • /5-things-hsa
  • /act-today-to-get-hsa-debit-card
  • /the-hsa-tax-plan
  • /the-advantages-of-open-enrollment
  • /other-employer-benefits
  • /selecting-health-insurance-taking-longer-view
  • /quadruple-hsa-savings-advantages
  • /free-hsa-provider
  • /401k-contributions
  • /the-hsa-mindset
  • /save-money-obamacare
  • /how-to-invest-your-hsa
  • /open-enrollment-2018
  • /hsa-balance
  • /hsa-tips
  • /why-i-switched-off-my-familys-health-insurance-plan-onto-my-own-high-deductible
  • /comparing-health-insurance-plans
  • /should-you-consider-using-a-health-savings-account
  • /how-are-ppos-and-hsas-related
  • /hsa-a-secret-retirement-weapon
  • /how-to-build-health-savings
  • /what-to-know-about-hsas-taxes-retirement
  • /how-to-pay-for-healthcare-costs
  • /transferring-ira-money-hsa
  • /hsa-growth
  • /maximize-your-hsa-savings
  • /common-hsa-misconceptions
  • /the-most-affordable-healthcare
  • /the-great-healthcare-debate
  • /hidden-hsa-fees
  • /high-deductible-health-plan-benefits
  • /hra-how-it-works
  • /what-are-the-benefits-of-an-hra
  • /fsa-how-it-works
  • /summer-sunscreen-hsa-qualified-hsa-expenses
  • /better-care-reconciliation-act-what-you-need-to-know
  • /hdhp-monsters
  • /comparing-the-hra-and-hsa
  • /health-savings-accounts-here-to-stay
  • /a-health-savings-account-infographic-snapshot-of-savings
  • /livelys-hsa-platform-now-live
  • /hdhp-hsa-or-traditional-low-deductible-plan
  • /5-twists-on-health-savings-accounts-you-may-not-know
  • /millennials-hsa
  • /open-enrollment-decisions
  • /why-we-started-lively
  • /goodbye-boston-hello-san-francisco
  • /individual-vs-family-hsa

All of the above we are moving to the livelyme .com /blog/ directory

We want to keep many other pages that exist in the current root.

Is this clearer or would you like to see a list of the pages we want to keep where they are at currently?

I think my example would work then…

What this says is “redirect all pages that does not exist on disk to /blog/”

I did a small test using this setup:

$ curl https://snorkypie-test.netlify.app
This is the index

$ curl https://snorkypie-test.netlify.app/test-directory
this is the test-directory in root

$ curl https://snorkypie-test.netlify.app/blog/test-directory
this is test-directory inside /blog

$ curl https://snorkypie-test.netlify.app/such-blog
Such blog, much love.

$ curl https://snorkypie-test.netlify.app/blog/such-blog
Such blog, much love.
netlify-test$ tree
.
├── _redirects        
├── blog
│   ├── such-blog     
│   │   └── index.html
│   └── test-directory
│       └── index.html
├── index.html        
└── test-directory    
    └── index.html    

netlify-test$ cat _redirects 
/* /blog/:splat 200

Let me know if there’s a problem!

@snorkypie thank you!!! Dumb question…Can I test redirects on the post production testing environment?

You can make these changes to a new git branch and test them using deploy contexts. Should be straight forward to set up.

@snorkypie I set this up here: https://6021d4b366165d0009fc6ccf--lively-react.netlify.app/
an example of a blog post is /average-cost-of-health-insurance-for-a-married-couple/

I see that the 200 code may not be what I want the server to tell people. Since all of my blog content is moving permanently to the /blog/ directory wouldn’t I want to use 301 moved permanently?

BTW simply amazing advice I am over the moon with this solution :slight_smile: :smiley:

Aha! I had misunderstood then! Yeah 301 is the way to go. My recommendation is to try it out with 302 first though until you see it’s working the way you want since 301’s are cached hard in the browser! Hope that solves it for you :slight_smile:

1 Like

@snorkypie this is working well so far thank you!

1 Like

@snorkypie This works except that we have a /static/ directory that is outside of our project that is being effected by this strategy.

https://60427701c473280008988c4a--lively-react.netlify.app/guides/hsa-guide/static/hsa-guide/guide-icons.css is now.a 404 and the correct URL starts at /static/: https://60427701c473280008988c4a--lively-react.netlify.app/static/hsa-guide/guide-icons.css

Here are the others that are now 404 from this change:

https://60427701c473280008988c4a--lively-react.netlify.app/blog/static/images/google-play-button.svg
https://60427701c473280008988c4a--lively-react.netlify.app/blog/static/css/marketo-forms.css
https://60427701c473280008988c4a--lively-react.netlify.app/blog/static/images/icon-new-twitter.svg
https://60427701c473280008988c4a--lively-react.netlify.app/blog/static/images/icon-new-facebook.svg
https://60427701c473280008988c4a--lively-react.netlify.app/blog/static/images/icon-new-linkedin.svg
https://60427701c473280008988c4a--lively-react.netlify.app/blog/static/images/app-store-badge.svg
https://60427701c473280008988c4a--lively-react.netlify.app/blog/static/images/small-green-arrow.png
https://60427701c473280008988c4a--lively-react.netlify.app/blog/guides/hsa-guide/static/hsa-guide/guide-icons.css
https://60427701c473280008988c4a--lively-react.netlify.app/blog/static/images/left-arrow.svg
https://60427701c473280008988c4a--lively-react.netlify.app/blog/guides/2020-tax-guide/static/hsa-guide/guide-icons.css
https://60427701c473280008988c4a--lively-react.netlify.app/blog/guides/flexible-spending-account-fsa/static/hsa-guide/guide-icons.css
https://60427701c473280008988c4a--lively-react.netlify.app/blog/static/images/icon-search.svg
https://60427701c473280008988c4a--lively-react.netlify.app/blog/static/calculators/payrollTaxIntro.css
https://60427701c473280008988c4a--lively-react.netlify.app/blog/static/calculators/hpcIntro.css
https://60427701c473280008988c4a--lively-react.netlify.app/blog/static/calculators/hpcDetails.css
https://60427701c473280008988c4a--lively-react.netlify.app/blog/static/calculators/payrollTaxEntry.css

Hoping you have a solution for this :slight_smile: Almost there! :slight_smile: :slight_smile: thank you!

My initial thought it that you should just update everything to point to /static instead but that might not be what you want? If not, you could probably try to just proxy them to the correct location instead.

Try something like:

/blog/static/* /static/* 200 before your /* redirect.

That should transparently do the right thing.

I see you also have a problem with /guides, it’s a bit tricky to give a good answer when we don’t know the exact underlying structure but doing something similar to the redirect above but for /guides should do the trick too?

That is, something like /guides/hsa-guide/static/* /static/hsa-guide/* 200 (also before your /* redirect).

Let us know how it goes!

1 Like

@snorkypie THANK YOU :100: :dizzy: :boom:

Works!

1 Like

Glad to hear it! To the moon!

1 Like

Hey there @snorkypie

We are encountering the following and hoping you can help:

Now when you visit a bad url you are redirected to livelyme.com/blog/doesnotexist but I intended to go to livelyme.com/doesnotexist is this something I can fix?

Hi, @Jennifer_G. This redirect is being caused by the following:

/* /blog/:splat 301

The rule above does the following:

  • Any URL which doesn’t match a deployed file will be redirected to that same path under /blog/.

If you don’t want that to happen, then delete the rule above from your _redirects file.

If you want some other behavior, please let us know what the required behavior is and we will do our best to find redirect rules that meet the requirements.

Hello @luke I would prefer that the blog posts redirect to /blog/ (current) and the 404 stays at the root.

Thanks for helping :slight_smile:

So I am curious about this redirect @snorkypie when I break it down to me it would redirect every page that is not accounted for in our next.config.js to /blog/ but here is our next.config.js file:

const withPlugins = require(‘next-compose-plugins’);
const Contentful = require(‘./utils/contentful’);
const Slugify = require(‘slugify’);

const nextJsConfig = {
// fix for imported assets that require url loader
trailingSlash: true,
webpack: function (config) {
config.module.rules.push({
test: /.(eot|woff|woff2|ttf|svg|png|jpg|gif)$/,
use: {
loader: ‘url-loader’,
options: {
limit: 100000,
name: ‘[name].[ext]’
}
}
});
return config;
},

async exportPathMap() {
var pages = {
‘/’: { page: ‘/’ },
‘/pricing’: { page: ‘/pricing’ },
‘/employers’: { page: ‘/employers’ },
‘/brokers’: { page: ‘/brokers’ },
‘/courtesyof’: { page: ‘/courtesyof’ },
‘/fsa’: { page: ‘/fsa’ },
‘/update-browser’: { page: ‘/update-browser’ },
‘/marketplace’: { page: ‘/marketplace’ },
‘/about-us’: { page: ‘/about-us’ },
‘/careers’: { page: ‘/careers’ },
‘/partners’: { page: ‘/partners’ },
‘/blog’: { page: ‘/blog’ },
‘/blog/employer’: { page: ‘/blog/segment’ },
‘/blog/broker’: { page: ‘/blog/segment’ },
‘/blog/partner’: { page: ‘/blog/segment’ },
‘/blog/search’: { page: ‘/blog-search’ },
‘/affiliate-program’: { page: ‘/affiliate-program’ },
‘/resources’: { page: ‘/resources/segment’ },
‘/resources/individual’: { page: ‘/resources/segment’ },
‘/resources/employer’: { page: ‘/resources/segment’ },
‘/resources/partner’: { page: ‘/resources/segment’ },
‘/app’: { page: ‘/app’ },
‘/whats-eligible’: { page: ‘/eligibility’ },
‘/features’: { page: ‘/individual-benefits’ },
‘/employers/features’: { page: ‘/employer-features’ },
‘/hsa-savings-calculator’: {
page: ‘/hsa-savings-calculator’
},
‘/hsa-contribution-calculator’: {
page: ‘/hsa-contribution-calculator’
},
‘/hsa-savings-calculator/’: {
page: ‘/hsa-savings-calculator/’
},

  '/compare-health-insurance-plans': {
    page: '/calculator-compare-health-insurance-plans'
  },
  '/compare-health-insurance-plans/your-details': {
    page: '/calculator-compare-health-insurance-plans-details'
  },
  '/compare-health-insurance-plans/plan': {
    page: '/calculator-compare-health-insurance-plans-plan'
  },
  '/compare-health-insurance-plans/alternate-plan': {
    page: '/calculator-compare-health-insurance-plans-alt-plan'
  },
  '/compare-health-insurance-plans/medical-expenses': {
    page: '/calculator-compare-health-insurance-plans-medical-expenses'
  },
  '/compare-health-insurance-plans/results': {
    page: '/calculator-compare-health-insurance-plans-results'
  },
  '/payroll-tax-savings': {
    page: '/calculator-payroll-tax-savings'
  },
  '/payroll-tax-savings/cost-and-contributions': {
    page: '/calculator-payroll-tax-savings-cost'
  },
  '/payroll-tax-savings/results': {
    page: '/calculator-payroll-tax-savings-results'
  },
  '/hsa-contribution-calculator': {
    page: '/hsa-contribution-calculator'
  },
  '/404': { page: '/_error' }
};

//Blog Posts
let blogPosts = await Contentful.query(
  {
    content_type: 'blogPost',
    limit: 1000
  },
  'misc'
);

for (let i in blogPosts.items) {
  if (blogPosts.items[i].fields.slug) {
    if (
      typeof blogPosts.items[i].fields.segmentId !== 'undefined' &&
      blogPosts.items[i].fields.segmentId !== 'individual'
    ) {
      Object.assign(pages, {
        [`/blog/${blogPosts.items[i].fields.segmentId}/${blogPosts.items[i].fields.slug}`]: {
          page: '/blog/article'
        }
      });
    } else {
      Object.assign(pages, {
        [`/${blogPosts.items[i].fields.slug}`]: {
          page: '/blog/article'
        }
      });
    }
  }
}

// Blog Categories
var blogCategories = await Contentful.query(
  { content_type: 'blogCategory', limit: 1000 },
  'misc'
);

for (const i in blogCategories.items) {
  if (blogCategories.items[i].fields.slug) {
    Object.assign(pages, {
      [`/category/${Slugify(blogCategories.items[i].fields.slug)}`]: {
        page: '/category'
      }
    });
  }
}

//Blog Tags
var blogTags = await Contentful.query({ content_type: 'blogTag', limit: 1000 }, 'misc');
for (const i in blogTags.items) {
  if (blogTags.items[i].fields.slug) {
    Object.assign(pages, {
      [`/tag/${Slugify(blogTags.items[i].fields.slug)}`]: {
        page: '/tag'
      }
    });
  }
}

//Blog Persona Tags
var blogPersonaTags = await Contentful.query(
  {
    content_type: 'blogPersonaTag',
    limit: 1000
  },
  'misc'
);

for (const i in blogPersonaTags.items) {
  if (blogPersonaTags.items[i].fields.slug) {
    Object.assign(pages, {
      [`/tag/${Slugify(blogPersonaTags.items[i].fields.slug)}`]: {
        page: '/persona-tag'
      }
    });
  }
}

//Feature Templates
var featurePages = await Contentful.query({
  content_type: 'pageFeatureTemplate',
  limit: 1000
});
for (const i in featurePages.items) {
  if (featurePages.items[i].fields.slug)
    Object.assign(pages, {
      [`${featurePages.items[i].fields.slug}`]: {
        page: '/feature'
      }
    });
}

//Basic Templates
var basicTemplates = await Contentful.query({
  content_type: 'pageSimpleTemplate',
  limit: 1000
});
for (const i in basicTemplates.items) {
  if (basicTemplates.items[i].fields.slug)
    Object.assign(pages, {
      [`${basicTemplates.items[i].fields.slug}`]: {
        page: '/basic-template'
      }
    });
}

//Small Business Templates
var smallBusinessTemplates = await Contentful.query(
  {
    content_type: 'pageSmallBusinessTemplate',
    limit: 1000
  },
  'misc'
);
for (const i in smallBusinessTemplates.items) {
  if (smallBusinessTemplates.items[i].fields.slug)
    Object.assign(pages, {
      [`${smallBusinessTemplates.items[i].fields.slug}`]: {
        page: '/small-business-template/small-business-template'
      }
    });
}

//Guide Templates
var guideTemplates = await Contentful.query(
  {
    content_type: 'pageGuideTemplate',
    limit: 1000
  },
  'misc'
);
for (const i in guideTemplates.items) {
  if (guideTemplates.items[i].fields.slug)
    Object.assign(pages, {
      [`${guideTemplates.items[i].fields.slug}`]: {
        page: '/guide-template/guide-template'
      }
    });
}

//Content Download Templates
var downloadTemplates = await Contentful.query(
  {
    content_type: 'pageContentDownloadTemplate',
    limit: 1000
  },
  'misc'
);
for (const i in downloadTemplates.items) {
  if (downloadTemplates.items[i].fields.slug)
    Object.assign(pages, {
      [`${downloadTemplates.items[i].fields.slug}`]: {
        page: '/content-download-template'
      }
    });
}

//Confirmation Templates
var confirmationTemplates = await Contentful.query(
  {
    content_type: 'pageConfirmationTemplate',
    limit: 1000
  },
  'misc'
);
for (const i in confirmationTemplates.items) {
  if (confirmationTemplates.items[i].fields.slug)
    Object.assign(pages, {
      [`${confirmationTemplates.items[i].fields.slug}`]: {
        page: '/confirmation'
      }
    });
}

//Why You need Templates
var whyTemplates = await Contentful.query({
  content_type: 'pageWhyYouNeedHsa',
  limit: 1000
});
for (const i in whyTemplates.items) {
  if (whyTemplates.items[i].fields.slug)
    Object.assign(pages, {
      [`${whyTemplates.items[i].fields.slug}`]: {
        page: '/why-you-need-an-hsa'
      }
    });
}

//Careers
var careers = await Contentful.query({
  content_type: 'pageCareer',
  limit: 1000
});
for (const i in careers.items) {
  if (careers.items[i].fields.url)
    Object.assign(pages, {
      [`${careers.items[i].fields.url}`]: {
        page: '/career'
      }
    });
}

//Careers
var security = await Contentful.query({
  content_type: 'pageSecurityTemplate',
  limit: 1000
});
for (const i in security.items) {
  if (security.items[i].fields.slug)
    Object.assign(pages, {
      [`${security.items[i].fields.slug}`]: {
        page: '/security-template'
      }
    });
}

//partners
var partners = await Contentful.query({
  content_type: 'pagePartnerTemplate',
  limit: 1000
});

for (const i in partners.items) {
  if (partners.items[i].fields.slug)
    if (partners.items[i].fields.slug.indexOf('?') >= 0) {
      Object.assign(pages, {
        [`${partners.items[i].fields.slug.split('?')[0]}`]: {
          page: '/partner-template'
        }
      });
    } else {
      Object.assign(pages, {
        [`${partners.items[i].fields.slug}`]: {
          page: '/partner-template'
        }
      });
    }
}

//authors
var authors = await Contentful.query(
  {
    content_type: 'author',
    limit: 1000
  },
  'misc'
);

for (const i in authors.items) {
  if (authors.items[i] && authors.items[i].fields.name) {
    const url = Slugify(authors.items[i].fields.name);
    if (url) {
      Object.assign(pages, {
        [`/author/${url}`]: {
          page: '/blog/author'
        }
      });
    }
  }
}

return pages;

}
};

module.exports = withPlugins(, nextJsConfig);

In practice this does not work. One case is the 404 which I mentioned plus pages that are in this file like:

https://livelyme.com/calculator-compare-health-insurance-plans-alt-plan is redirecting to https://livelyme.com/blog/calculator-compare-health-insurance-plans-alt-plan

The nextconfig states: ‘/compare-health-insurance-plans/alternate-plan’: {
page: ‘/calculator-compare-health-insurance-plans-alt-plan’

This: https://livelyme.com/calculator-compare-health-insuran ce-plans-medical-expenses/ https://livelyme.com/blog/calculator-compare-health-insur ance-plans-medical-expenses/

nextconfig: ‘/employers/features’: { page: ‘/employer-features’ }, works:

But this redirects to blog: https://livelyme.com/employer-features/invest/
https://livelyme.com/blog/employer-features/invest/
AND is not in the nextconfig file (is that the problem here? Do all pages need to be identified in nextconfig.js?

This is a pretty hairy animal. I appreciate any help I can get here - thanks @luke

Hey there @Jennifer_G :wave:

Are you still encountering redirects questions? It looks like it has been a few days since this thread was active. If you are, please let us know. If not, I encourage you to share what steps you took to solve this!

So we ended up removing the splat redirect and placing code that would redirect current blog posts and the future ones into the blog directory. The splat was too problematic. We also discontinued using the _redirects and are using a redirects file in the root.

Thank you for sharing, @Jennifer_G ! I am glad that you found a solution that worked, and we appreciate you sharing it here :netliconfetti: