user734024
user734024

Reputation: 13

URL encoding for spaces

Is it possible to encode space to a '-' in the URL.

http://www.brandedproducts.com.au/Cotton%20Conference%20Bag%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20%20-34-1-0-0-IPPP1070

Kindly assist me.

[edit: fixed confusing 'a-']

Upvotes: 1

Views: 1223

Answers (2)

scaryzet
scaryzet

Reputation: 923

str_replace('%20', '-', 'your url here');

Now I'm confused with the question, lol.

Upvotes: 4

Tremmors
Tremmors

Reputation: 2966

You can make a rewrite rule to translate dashes into spaces, so when the request comes in it is properly handled. The problem will be making the links correct when they are rendered. You'll have to manually replace spaces with dashes before you do any sort of URLEncode.

Upvotes: 0

Related Questions