I have followed everything exactly from the documentation video and I have tried looking online for what I am doing wrong but I have found no answers. Here’s the video:
I have tried talking to netlify support but I have been passed around to 3 different people that have each not solved my problem or my understanding of it. I am at my wits end trying to understand why something so simple is giving me so much trouble. Any help is appreciated.
that works and is a lot better than what was there before. I’m going to keep that there, but what do I do about https://bobthedentguy.netlify.com/ redirecting to https://www.bobthedentguy.com/ ? Also, the urls still have the html/ folder in them. What can I do about that?
For the netlify subdomain redirect, you will need to go into your DNS and make the desired adjustments. Link below. If you have trouble with this, please open a new topic for help in the dns category.
As for the html redirect, something like this should work without the .html appended (note, not tested)
[line1] proxy rewrites the path /html/index.html to the root which means the path /html/index.html will stay in the address bar and show the /index.html content (incorrect?)
[line2] proxy rewrites the path /html/about.html to /about-bob-the-dent-guy which means the path /html/about.html will stay in the address bar and show the /portfolio/index.html content (incorrect?)
[line3] proxy rewrites the path /html/portfolio.html to /portfolio which means the path /html/portfolio.html will stay in the address bar and show the /portfolio/index.html content (incorrect?)
[line4] proxy rewrites the path /html/contact.html to /contact-bob-the-dent-guy which means the path /html/contact.html will stay in the address bar and show the /contact-bob-the-dent-guy/index.html content (incorrect?)
[line5] redirectshttps://bobthedentguy.netlify.com to https://www.bobthedentguy.com/html/index.html
Can you define what you want to happen?
In example, give the condition of what the user will type into the address bar then what will happen for each use case.
User types in address bar: /html/index.html
Result: <explain that here>
Explanation of 200
The 200 is used for proxy rewrites and does not redirect to the result path. A 200 tells the CDN to keep the path in the address bar, but show the target path as the response.
I copy and pasted your code but the pages return a 404. i changed the html folder to “bobsite” so it’s cleaner than html/about etc. I added the pretty url feature as described to me by another, but when I try to add the 200! rewrites to the new pretty url paths i still get 404. When a user is on the home page and clicks the ABOUT tab I want the new page to be bobthedentguy.com/about. But the rewrites never seem to work. I added https://bobthedentguy.netlify.comhttps://www.bobthedentguy.com/ 301! to redirect the netlify subdoiam to the main domain for SEO purposes but that doesnt work either. The github has been updated accordingly
The above worked when I forked your repo and tried it with the current structure.
Explanation (using pretty urls)
The first redirect is the pretty url path (rewritten by the CDN) redirected to the simple path (proxy) that really does not exist.
The second proxy rewrite (200) is rewriting the url path and making a proxy to the static content.
that worked! Thank you. I have no idea what that code means but I’ll try and replicate it for my other sites. No we just need to redirect the .netlify subdomain to the main domain
I have image, js, html and css files in their own folders for cleaner file management and make it easier to find the ones I’m looking for. I created the site just using html css and javascript. No frameworks or anything. I have a client that has like 20+ html pages and accompanying css files so it will be messy if I don’t put them in files.
No problem, but doing these proxies will get confusing later if you ever stop using absolute paths to your assets. This works, because the asset paths are where they are expected.
Your setup is simple, but could get confusing when paths go bad.
Thank you for you help, I would never have figured this out without you. Why do we need the 301’s in there? Just asking so I can better understand what is happening and why. And when I type bobthedentguy.netlify.com it doesn’t redirect to bobthedentguy.com. Do I need to do something different there too? I don’t want google to penalize the main domain for duplicate content
This will redirect any path at the netlify domain to the primary domain if someone tries it. It will also tell google to redirect permanently from now on and not see it as a duplicate.
Final
Note: redirects will go in order, so you want to make sure you capture the condition ahead of the resulting paths.
no problem, I’m really grateful for you time in the matter. I tried putting the domain redirect at the top just as you said but it still doesn’t redirect. Not sure hats going on. Does it take a while for it to work?
If so, the 404 is because that subdomain isn’t active for any Netlify site. The 404 happens and there is no redirect because there is no such site at Netlify.
If it is another subdomain having this issue, would you please let us know what the exact redirect rule is?
Note, I don’t currently see any redirects for bobthedentguy.netlify.com which change the domain name - meaning redirects like this one: