0

I want to encode the post's title so I can add it to my URLs. The problem is that urlencode() gives me an URL such as:

Title:

Samsung Nexus S + Hard Case

URL:

Samsung%20Nexus%20S%20+%20Hard%20Case

And I want one more friendly like:

Samsung+Nexus+S+Hard+Case

I don't know what should happen to the '+' symbol. How can I do this?

1 Answer 1

1

Replace the spaces with + since %20 is the url encoding of a space. Here's an example of space replacement in PHP:

str_replace(' ', '+', $url_encoded_string);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.