Home
Support Forums

I can't make redirects happen. I have read, I have tried and it did not work

Hello everyone !

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.

This is my file.

for root

/*              /index.html     200
/404/*      /404.html   200
/material-ui-color-picker/*      /material-ui-color-picker.html   200
/color-code-converter/*         /color-code-converter.html   200
/color-contrast/*      /color-contrast.html   200
/resources-for-designers/*      /resources-for-designers.html   200
/resources-for-developers/*      /resources-for-developers.html   200
/css-gradient-patterns/*      /css-gradient-patterns.html   200
/css-gradients/*      /css-gradients.html   200
/index/*      /index.html   200
/font-pairings/*      /font-pairings.html   200
/legal/*      /legal.html   200
/markdown/*      /markdown.html   200
/html-reference/*      /html-reference.html   200
/newsletter/*      /newsletter.html   200
/color-palettes/*        /color-palettes.html     200
/css-reference/*      /css-reference.html   200
/sponsors/*      /sponsors.html   200
/tailwind-color-picker/*      /tailwind-color-picker.html   200
/variable-fonts/*      /variable-font.html   200
/glyphs/*      /glyphs.html   200

Any idea how to take care of this?

If you need to look at the site is this.

Thank you so much in advance really appreciate

hi there, are the redirects being processed?

and i realize you mentioned you have already been doing some reading, but i’m not sure if you saw this big guide on redirects?

if not, please post again, and we’ll try and troubleshoot.

@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.

2 Likes

Hey,
I have not seen this. all I had to do was click on prettify the urls…

Thank you so much.

Hey,
I have not seen this. all I had to do was click on prettify URLs. Actually I did not thank you so much

Thank you so much.

I also have a problem and I have burned a lot of time to solve it.

I want a simple netlify hosted site to redirect directly to an external domain upon loading.

This is my (correctly processed) netlify.toml:

[[redirects]]
  from = "https://suspicious-kilby-xxxxb.netlify.app"
  to = "https://medium.com/@xxxxx"
  status = 301
  force = true

I need urgent help!

You might try something like:

[[redirects]]
  from = "/"
  to = "https://medium.com/@xxxxx"
  status = 301
  force = true

You can also accomplish much the same thing with a meta refresh tag on an index.html file on your Netlify subdomain.

@gregraven I tried your combination. Literally has no effect. Like all the others. Meta refresh tags are officiallz disouraged.

Hey @dawg :wave:t2:

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 :slight_smile:

Hope that helps.


Jon

Yes, and the redirects are processed.

Thanks Jon,

I did try that myself, it is a natural idea. Doesn’t do anything. I wonder: could this be a browser issue? I have no other redirect problems though.

Yes, it was a browser issue. Quite crazy. Is there a way to add a delay like one would with meta tags using the netlify.toml

@jonsully Thanks for making that correction. I’ll know better than to try to make these posts on my phone in the future.

Hey @dawg

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 :tada:

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 :slight_smile:


Jon