Support Forums

Is there a way to escape an asterisk (*) within the _redirects file?

I currently have a redirect rule set up in a _redirects file.

https://www.example.com/* https://example.com/:splat 301!

And that works great! However, I’m currently experiencing an SEO issue when I’m 2 folders deep.


On all directories that are double nested, and if I have a link back to my home page… for whatever reason Google picks up the URL as https//:example.com/* with an asterisk at the end!

I’m really not sure why it is happening and only when it is 2 directories deep. I don’t have any links set up that go /* so I don’t understand where it is coming from, but I thought it might be from the _redirects file.

As a fix, I wanted to re-direct the exact route https://example.com/* to one without the asterisk.

So I set up the following rule
/* /index.html 200

But then I lose my 404 page and everything that isn’t found gets redirected to the homepage. I don’t want this. I just want one specific case (with the *) to get re-directed.

Is there a way to escape the * character in the redirects file? So it just picks up a match with the character *, instead of everything after the URL?

Something like /\* ?

I tried looking through the docs, but couldn’t find anything about escaping that character. Any help would be appreciated.

Nevermind about this issue. It seems that this is a site building issue and some urls in the meta tags aren’t written correctly.