What's wrong with my _redirects file?

I’m deploying Dev.to -> Stackbit (Fresh theme) -> Hugo -> Netlify. Nearly everything is working really well for me (aside from figuring out how to easily import old blog posts into Dev.to, but I know the real solution, which is an RSS feed, which I just don’t have available right now - long story but content is not hosted, only in DB backups).

However, one thing I just cannot get to work is the Netlify subdomain redirect to my custom domain (otherwise, my custom domain is working great with NS records pointing to Netlify for that subdomain). I’m trying to use the _redirects file to do this, but have never had any luck getting it to work. I think I’m doing it right, but obviously not.

Site: https://shanes-blog.netlify.com/
Custom domain: https://words.jax.io/
Github: https://github.com/jaxidian/stackbit-blog/

Hi, @Jaxidian, and welcome to our Netlify community site.

I looked at the most recent deploy here:

https://app.netlify.com/sites/shanes-blog/deploys/5ddf52510662bc00072f3eda

That page says the following:

No redirect rules processed

This deploy did not include any redirect rules. Learn more about redirects.

Looking at the repo, I believe the issue is happening because the file _redirects isn’t being included in the publish directory.

You might be able to fix this by changing to the build command in netlify.toml from this:

[build]
publish = "public"
command = "./stackbit-build.sh"

To this

[build]
publish = "public"
command = "./stackbit-build.sh && cp _redirects public"

The _redirects file itself does look correct to me so I do believe this change is all that is required.

If this doesn’t work, please let us know.

That did it! Thank you very much!

I was so completely focused on the contents of the redirects file that I forgot to check to see if it was even being deployed. :smiley:

1 Like