This might involve PHP or Apache’s .htaccess. I would like to understand how Facebook does their URL scheme. Like when you have a profile such as
/spaceshiptrooper
And then you put periods in that string
/space.ship.trooper
It gets treated like
/spaceshiptrooper
How is this possible? Do they just strip out the periods and the select and compare it to an sql string? What about if the profile has random periods in it and the requested string doesn’t? How do they treat it the same?
Currently, my application only allows alphanumeric and underscores. I want to allow underscores and periods. So mine basically is already set up to allow both via .htaccess already, however, I can’t seem to understand the concept and how you would do that to get the right profile using PHP.
Well. The application is using MVC so all request get sent to the same controller file. So the main problem is going to happen in PHP. Because if the profile doesn’t exit, it’ll already load up the 404 error page. Everything is working. Just that I don’t know how to go about it since if you try Facebook’s URL scheme, no matter where you place the period, you will be shown the same profile. This only does not work with certain profiles because they had their profile before this change. Basically, what I was think was to strip out all the periods from the requested profile. Then strip out all the periods from a database call and then compare them. If they are the same, they should be the same profile. However, I feel there’s a down side to this. So I would like to know how Facebook did theirs.
Because if you think about it, users can’t have the same usernames anyways. So having the same username with space.ship.trooper would be the same as spaceshiptrooper once you do the comparison.