We are no longer offering accounts on this server. Consider https://gitlab.freedesktop.org/ as a place to host projects.

Commit ef3b3e7c authored by Jonas Haraldsson's avatar Jonas Haraldsson

Fix url rewrites in nginx

parent 0f1370c2
......@@ -27,10 +27,15 @@
* @return string A mod_rewrite compatible encoding of the given text.
*/
function rewrite_encode($url) {
$url = urlencode($url);
$url = preg_replace('/%2B/', '%252B', $url); // +
$url = preg_replace('/%2F/', '%252F', $url); // /
$url = preg_replace('/%26/', '%2526', $url); // &
$url = preg_replace('/%23/', '%2523', $url); // #
if (preg_match('/Apache/', $_SERVER['SERVER_SOFTWARE'])) {
$url = urlencode($url);
$url = preg_replace('/%2B/', '%252B', $url); // +
$url = preg_replace('/%2F/', '%252F', $url); // /
$url = preg_replace('/%26/', '%2526', $url); // &
$url = preg_replace('/%23/', '%2523', $url); // #
} else {
$url = rawurlencode($url);
}
return $url;
}
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment