0

So I have an interesting problem here. I am using URL Routing to mask the URL but I want to take the spaces out.

For example:

/sanjuan/ but in the database it's San Juan. An error is thrown when I type it in because clearly theres a space in the DB. I don't want it conjoined in the DB though.

How can I accomplish this. I just need some ideas to look into.

2 Answers 2

1

What rob described is called slugging.

Have a look at this:

http://predicatet.blogspot.com/2009/04/improved-c-slug-generator-or-how-to.html

Sign up to request clarification or add additional context in comments.

2 Comments

+1 for defining it, I didn't know there's a term for that until now.. :)
I'm not quite sure what this does.
1

you could replace the space with - when rewriting the url, and change back the - back to space when reading it.

3 Comments

I wouldnt want someone to type san-juan though
@Bry4n, you can use /san juan/ still but I think not all browsers reads space, and most browsers replace space with %20
Right they do but I dont want there to be any spaces in the url, but only in the database. I'm considering creating a different field for just the link =/

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.