I am making a page where the content is dynamic, but up til now i have only been able to get the page i want with variables such as (using stackoverflow as a example): https://stackoverflow.com/questions?q=7980734
but as seen in stackoverflow they have it as
https://stackoverflow.com/questions/7980734/dynbamic-url-and-adding-a-the-title-to-the-end-of-the-page-url
i just want to know how they make like that (using /) without creating individual pages for each question.
and also how do they add the title to the end of the url without creating a new directory.
i.e. if you type in
https://stackoverflow.com/questions/7980734/
it would still take you to the question, and then will add in the title.
Thank you for any help!
Most of the time using a .htaccess file to rewrite certain URL’s when they are requested will be sufficient. For example stackoverflow might use something like this:
This would make both stackoverflow.com/questsions/1234/a-title-of-a-page and stackoverflow.com/questions.php?q=1234 the same page, so on your website you would need to use the “tidy” version of the URL (the first one)
A lot more can be read into this and you can customize you’re URL’s to what you require. For example, a few places to read up on it include:
http://httpd.apache.org/docs/2.0/misc/rewriteguide.html
http://www.easymodrewrite.com/