I'm new to websites with databases and was wondering how to make a url look like

https://domain.tld/H34d2b rather than https://domain.tld/?p=H34d2b

I had an idea of forwarding the page to a 404 PHP script, so /H34d2b doesn't exist but the 404.php could read the url and display the content; but this seems a bit messy and would like to check if there is a better way other than what I am about to do.

I tried searching for this but I don't know how else to search for this other than url variables and I keep getting ?v= - which is not a format I'd like.

  • Are you using a CMS? If you are, there may be an inside mechanism to do this.
    – xpy
    Dec 15, 2015 at 13:23

1 Answer 1


If you're using Apache or a compatible web server you need to use: mod_rewrite - http://httpd.apache.org/docs/current/mod/mod_rewrite.html


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.