So…I have been trying to do de redirects as the Netlify page and community says but I am stuck not making it happen…
My intention is to remove the .HTML extension from the URL
I normally drop the folder on the deploys page…if you need to know.
@michael-andreuzza Maybe I don’t understand what you’re trying to do, but it seems to me that you have things exactly backwards.
If you want /about.html to display as /about, then you don’t want redirects (which don’t do this), you want Pretty URLs in the Asset Optimization section of the Build & Deploy section in your Netlify dashboard.
It sounds as though what you should do is have – for example – /sponsors/index.html instead of /sponsors.html. When visitors hit this page, it would display in the URL field as /sponsors.
If your intention is to simply have any requests to your Netlify site unilaterally redirect to Medium, I think we just need a star - so I’ll amend @gregraven’s code above to:
[[redirects]]
from = "/*"
to = "https://medium.com/@xxxxx"
status = 301
force = true
I’ve got this same sort of redirect running on a site right now and it works great. Effectively turns a Netlify Site + Netlify DNS into one big (geographically distributed) redirect engine… but should do the trick
Netlify’s Redirects aren’t a browser thing per se. A “redirect” is really a 301 or 302 response from a server with a Location: https://foo.bar header… the browser just follows that Location. The only way the client server could be messing that up is if they already have a 301 stored for a location. 301 = Permanent Redirect. 302 = Temporary. Most browsers to store / cache the 301 redirects that way if you type in the address again in the future, it already knows to redirect you to the new location without having to hit the server, since it’s a permanent redirect. The browser truly believes (and acts like) it’s permanent.
I can confirm with certainty that the redirect I wrote you would work, but I can’t manually verify for you because I’m not sure what your netlify site URL is/was. Either way, I always recommend checking if / how redirects are working by sending requests from command line and watching the responses. Command line tools don’t cache/store redirects so you’ll get the server’s raw response every time.
In a similar manner, on my website jon.fm, I redirect all traffic from an old domain (jsul.ly) to jon.fm. Here’s what it looks like when I request jon.fm from command line (I use httpie rather than cURL, but either works):
On the first outbound request, the response is a 301 and the Location is https://jsul.ly/ - this is because Netlify enforces SSL/HTTPS on all requests before running redirects. This is useful for other reasons, but we don’t need to get into it. The first redirect is just pushing me to HTTPS. httpie then follows the redirect (“Redirecting to https://jsul.ly/”). The second outbound request then comes back with another 301 but this time with the Location: set to https://jon.fm/. That is the redirect record I have in place correctly executing on Netlify’s APN. Once again httpie follows the redirect and finally requests my actual site, and the site content comes back
So you may have had some caching problems with the permanence of 301.
If you’re still having issues and willing to provide the site URL and/or if your code is open source and you’re willing to provide the repository for us to look at to further assist, please do