Forum Moderators: phranque
RewriteEngine On
RewriteRule ^sport/([^/]+)/([^/]+).html sport.php?page=$1&var1=$2&var2=$3 [L]
On my .php page I've this:
<?php echo $_GET['var1']?> ; <?php echo $_GET['var2']?>
So, if digit the url: www.mydomain.xx/sport/soccer/john.html
on my page I'll have
Soccer ; John
but if I digit the url www.mydomain.xx/sport/soccer-team/Liverpool.html
I'll have:
soccer-team ; Liverpool
I would like to replace the "-" in the page in the word "soccer-team" and replace it with a space but I want to keep the "-" in the url.
How can I do this?
I hope you've understood.
Thank you
<?php echo str_replace("-", " ", $_GET['var1'])?>
That way any dashes in the URL get converted to spaces. Useful unless you need the dash character. If that's the case, consider using another delimiter, such as ^ or ~.