Alex
Alex

Reputation: 9

Php url space replace with dash(-) by .htaccess file

I've php link like that

echo "<h4><a href='$bname_d'>$bname_d</a></h4>'

If $bname_d = Creativeartbd host company then the url is show

http://mysite.com/Creativeartbd host company (2 space in this url)

So how do i replace this space with dash by php/.htaccess ?

Currently I used following .htaccess rules

RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ /businesspage.php?page=$1 [L]

Thanks for your help.

Upvotes: 0

Views: 954

Answers (1)

shashikant_
shashikant_

Reputation: 122

pass the url through this <?php $bname_d = str_replace(' ','-',$bname_d); ?> that will replace spaces with '-'

Upvotes: 1

Related Questions