Jump to content

Add (-) to the name btween words


egturnkey

Recommended Posts

hello dear friends,

 

Let say i have something called name

 

$name = "i love phpfread";

 

and say i have a link

 

$URL = "http://something/$name";

 

so now the url will be shown like this

 

http://something/i love phpfread

 

how i can make like this

 

http://something/i-love-phpfread

 

see (-) btween each word

 

 

does it needs a command at .htaccess !!  :shrug:

Link to comment
https://forums.phpfreaks.com/topic/195095-add-to-the-name-btween-words/
Share on other sites

I dont think url http://something/i-love-phpfread this will lead you to any where unless you have folder "i-love-phpfread" or filename i-love-phpfread.html or i-love-phpfread.php in the domain "something". but seeing stuffs, i think you want to use url rewriting. just replacing blank space with "-" wont let you anywhere. Again if you want to use url rewriting, then what if $name="A's best php theory/practice book"  or similar?? for these kind of texts you have to use regex pattern.

I dont think url http://something/i-love-phpfread this will lead you to any where unless you have folder "i-love-phpfread" or filename i-love-phpfread.html or i-love-phpfread.php in the domain "something". but seeing stuffs, i think you want to use url rewriting. just replacing blank space with "-" wont let you anywhere. Again if you want to use url rewriting, then what if $name="A's best php theory/practice book"  or similar?? for these kind of texts you have to use regex pattern.

 

or mod_rewrite.

@teamatomic

thanks it works perfect

 

@watsmyname

Yes, i know and i just mention an example and indeed i've made changes in .htaccess to fit with the changes and i've test it and works perfect

 

@Rustywolf

Indeed that was the idea, i made the change in the main $Url then changes in .htaccess

 

 

thanks you all for your replies it was helpfull to me .

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.