3 ms·
Ask HN: How to Create Vanity URLs in PHP
Hi, I'm looking to create Vanity URLs for every user on my website (in PHP), like xyz.com/userone - which will host his profile. Editing may or may not be on the vanity URL.
Any ideas/tips/resources on how do I o about doing this ?
- auston 16y agoare you using a framework? usually comes built in with most php frameworks.
- slater 16y agoStart with GET variables, eg. example.com/?bla/something/whatever Use a .htaccess file to re-route every 404-resulting request (eg xyz.com/bla/something/ doesn't really exist) to index.php, then you can explode() the $_GET variable (look at what $_SERVER outputs).