Forum Moderators: coopster
Using urlencode works, it replaces spaces with a + but it results in some character codes like % 26 for & that don't work in a browser with this script. So pretty sure my RewriteRules are correct, for example this set-
RewriteRule ^([^/]+)/Artist/([^/]+)/$ search.php?typ=$1&search=$2 [L,NC]
RewriteRule ^([^/]+)/Artist/([^/]+)/([^/]+)/$ search.php?typ=$1&search=$2&page=$3 [L,NC]
Results in URLs-
domain.com/word1+word2/Artist/artist+name/
domain.com/word1+word2/Artist/artist+name/1/
When using urlencode and-
domain.com/word1%20word2/Artist/artist%20name/
domain.com/word1%20word2/Artist/artist%20name/1/
When using nothing to convert spaces.
If I add a function like-
function safeurl($name){
$retVal = str_replace('/',' ',$name);
$retVal = str_replace(' ','-',$retVal);
return $retVal;
}
With corresponding code-
href="'.$site_url.''.safeurl($typ).'/Artist/'.safeurl($artist).'/1/
It replaces spaces with a hyphen, but clicking the link fails!
The site uses a CSV file as data source (no database).
I'm stuck on what to try next?
David