Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
0 votes
in Q2A Core by

Right now the url structure is like this http://example.com/123/question-one-sample

how can i have this one ? http://example.com/123/question-one-sample.html

as you can see above i would like to add the .html ath the end of any question url

How can i do this ??

Q2A version: 1.6.3
This would mean 5 letters more for your users to type in.
Not really. All it matters is the question ID. EG: http://www.question2answer.org/qa/42124/zzzzzzzzzzzzzzzzzz still links to this question
Yes, *I* know, but do his users now?! :)
Why on earth would you want to do this? There is literally no benefit to it whatsoever.

1 Answer

0 votes

You say "in any question url". Take into account that in order to do that you might need to hack the core or everride a very low level function. The result might be unpredictable, particularly if using plugins that rely on the core being untouched.

Also note that how the URL is built has nothing to do with the question page but rather with the page that links to the question page. So the safeset way to change this would be in those other places.

The simplest and safest change you can do to satisfy this requirement in most scenarios would be to add the suffix when generating the items in questions lists. You can do this from the qa-theme.php file, by adding this function, or merging it if it is already there:

function q_item_title($q_item) {
    $q_item['url'] .= '.html';