Trouble with regex redirect

Hi, I hope someone can help or at least tell me if what I’m trying to do is possible or not.

I have a site with pages such as:

and I’m moving to a layout with versions for top level navigation, like:

I wanted to use a redirect so if anyone tried the url, it would put them to the 1.1 version at The following works for pages that exist:

  /(.*): '/1.1/$1'

However if I purposely try a url for a page that doesn’t exist (such as ‘’) the browser window crashes and I see a ERR_TOO_MANY_REDIRECTSerror and the url looks like:

I thought maybe my redirect regex was too general and could be causing that loop, so I tried a more specific one:

  /(Getting-started.*): '/1.1/$1'

Again this works for “Getting-started” pages that exist, but if the page doesn’t exist it triggers the ERR_TOO_MANY_REDIRECTSerror again.

Is it possible to do what I’m trying to do? To have a redirect like this without losing the general 404 functionality on urls which match the regex but don’t have a page?

Thanks in advance!

The way you have it, it matches everything, and always rewrites it to prepend with /1.1 hence your infinite loop problem.

What you need to do is match on anything that doesn’t already start with /1.1 using a negative lookahead:

so you would have:

  ^(?!\/1.1)(.*)$ : /1.1/$1

Try that.


  '^(?!/1\.1)/(.*)$': '/1.1/$1'

Of course this only is triggered if the original page is not found at the path requested.

Thank you, rhukster! That helped a lot. I suspected my regex was off. Much appreciated!