git.gnu.io has moved to IP address 209.51.188.249 -- please double check where you are logging in.

Commit 5b422bf5 authored by Clint Adams's avatar Clint Adams

Encode usable URLs for nginx.

parent 0a823a8e
......@@ -27,10 +27,10 @@
* @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); // #
$url = rawurlencode($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); // #
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