Hi everyone, I need help to do redirecting path content to subdomain. To help you to understand, for example that my domain is https://www.example.com/ and my website content is available in the domain path https://example.com/blog. I want to make my website content available at https://blog.example.com .
[[redirects]]
from = “https://blog.example.com/*”
to = “https://example.com/blog/:splat”
status = 200
There was a force = true in your example and not in mine. Including this may be better depending on the use case so please do include it if you prefer:
[[redirects]]
from = “https://blog.example.com/*”
to = “https://example.com/blog/:splat”
status = 200
force = true
This would match the _redirect rule with a 200! like so:
This doesn’t seem to be working as expected for me. I’ve got my site living at example.com with a blog page at example.com/blog and all it’s individual posts at example.com/blog/*
I’ve added blog.example.com as a domain alias on netlify and have the following in my netlify.toml
[[redirects]]
from = "https://blog.example.com/*"
to = "https://example.com/blog/:splat"
status = 200
but when I try and visit blog.example.com it just shows me the contents of example.com (url remains blog.example.com) and when I visit blog.example.com/post-1 it shows me the correct content but now the url is blog.example.com/blog/post-1 - notice blog in both the subdomain and the path
Hi, @raivatshah, would you please send us the URL which should redirect and does not? With that information we can research issue and find out what is happening.
I`m having exact issue with my NUXT3 project.
Tried this netlify.toml script
[[redirects]]
from = "https://stats.ro-community.com/*"
to = "https://ro-community.com/stats/:splat"
status = 200
force = true
With status 200 and 301. And with a different destination URL.
The builder shows me there are “2 redirect rules processed” (+1 than default build) so the script/redirect is analyzed. However nothing happens when accessing https://stats.ro-community.com.
Further details:
I made stats.ro-community.com as an ALIAS to master/default domain (Tried to make a DNS/CNAME entry but it would not compute - 404 not found)
What i`m trying to accomplish is to split the folders into subdomains for the ease of access & SEO.
The redirect required by Next is being added before your redirect. If you’re adding the Nuxt redirect yourself (the one to /.netlify/functions/server), you need to move that below the redirect you’ve mentioned above. If you’re not adding it manually, that means Nuxt is adding that and in that case, you need to contact them as its a bug. User-configured redirects should be added before the framework’s redirects for those to work fine.
Ok. Thanks. Guess I`ll wait… Nuxt3 is too fresh and is lacking most of the documentation, including this routing part. Oh well…
I`ll use default subfolders instead of subdomains for now.
Thanks for your fast reply though.
3 days since I deployed my project on netlify and already in love with it <3