Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emulating the QSA (query string append) using redirect handler #10

Open
thul opened this issue Apr 17, 2014 · 1 comment
Open

Emulating the QSA (query string append) using redirect handler #10

thul opened this issue Apr 17, 2014 · 1 comment

Comments

@thul
Copy link

thul commented Apr 17, 2014

It took a lot of googling and asking in the IRC channel to get this. Might be handy to add thing to the cookbook / docs.

Most applications will work if your regular expression is ^(.*)$ and the substitution is /index.php?path=$1

But if you have an application that uses urls like "/settings/panel/ssh/?edit=true" you will end up with a rewrite like: "index.php?path=/settings/panel/ssh/?edit=true" which will break and return a 404 due to the double ?

The solution is to use the regular expression: ([^\?])(?:?(.))?
and as substitution: index.php?path=$1&$2

If $2 is empty you'll have a weird trailing & but this shouldn't break anything.

note: Phabricator is one of the applications that uses query strings in their friendly urls.

@lylebrown
Copy link

@thul I'll see if I can figure it out myself, but can you put your full list of cherokee rewrite rules for phabricator up on github, similar to how I've done for YOURLS in lylebrown\YOURLS-Cherokee?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants