Jump to content

Recommended Posts

i tried searching but came up with nothing..

 

is there a way in php that i can have all the spaces in a url replaced with hyphens? for example.. i have a car part in a database, and the url would be..

 

domain.com/parts/bmw m5 radiator cooling fan assembly.html

 

i have that mod rewrite option.. but how can i make it ..

 

domain.com/parts/bmw-m5-radiator-cooling-fan-assembly.html

 

thanks..

Link to comment
https://forums.phpfreaks.com/topic/187995-url-hyphens-instead-of-spaces/
Share on other sites

I think the simplest answer here is probably just 'no'. PHP has a function called urlencode which you can use for turning strings that contains invalid URL characters into valid URL characters and urldecode for changing it back again, this will replace spaces with either + or %20. With mod_rewrite we really need more information to work out exactly what your trying to-do. You will need to list...

 

- what a URL should look like in the users browser

- what the filename is of the file on the actual server

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.