VolkNet
04-24-2005, 11:41 PM
I am trying to think of a way to rewrite a URL to work with how I want it.
For example I'm trying to have the spaces in the URL coded as - rather than +
<?php
function encode_url($url){
$newUrl = urlencode($url);
$urlnew = str_replace('+', '-', $newUrl);
return $urlnew;
}
print(encode_url("this is a test"));
?>
This works and prints out 'this-is-a-test'.
What I also would like to achieve using this is all the %20 and %21 etc codes to be removed. Can someone give me a list of all the common % codes? Thanks.
For example I'm trying to have the spaces in the URL coded as - rather than +
<?php
function encode_url($url){
$newUrl = urlencode($url);
$urlnew = str_replace('+', '-', $newUrl);
return $urlnew;
}
print(encode_url("this is a test"));
?>
This works and prints out 'this-is-a-test'.
What I also would like to achieve using this is all the %20 and %21 etc codes to be removed. Can someone give me a list of all the common % codes? Thanks.
