Search code examples
regexhttp-redirectcherokee

Cherokee redirect


My server is running Cherokee and I'm trying to get a redirect to work. I'm running into troubles with infinite redirect loops because I am redirecting to the same folder.

My URL is:

http://domain.tld/example-variable (http://domain.tld/product-1234)

This needs to be redirected to:

http://domain.tld/index.php?item=variable (http://domain.tld/index.php?item-1234)

The Regex I have tried is:

^/product-(.*) /index.php?item-$1

This redirect is working. However, http://domain.tld is now broken as well as files like images (http://domain.tld/image.jpg). Other redirects I'm using are working just fine, but they redirect a folder to another folder (i.e. /folderA to /folderB).


Solution

  • @brent I've tried that indeed and all combinations I could think of where not solving the problem.

    I ended up using a subdomain:

    product.domain.tld/1234