How does a site like SO put the title of the question dynamically into the url bar.
Is this through rewritemapping and mod rewrite and how can I do it on a normal web host. Thanks
How does a site like SO put the title of the question dynamically into the url bar.
Is this through rewritemapping and mod rewrite and how can I do it on a normal web host. Thanks
In this URL:
https://stackoverflow.com/questions/10903041/how-to-automatically-put-title-in-url
the only part that matters is the question ID, 10903041
. So just set up a redirection rule that ignores anything at the end of the URL, much like this:
RewriteRule /questions/(\d+) question.php?id=$1
The PHP script can then redirect to the correct title if the title is not already provided or is incorrect; much like what happens when you visit https://stackoverflow.com/questions/10903041/why-is-this-question-title-so-wrong?.