Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.

closed How to disable domain.com/qa default home page?

+1 vote
asked Jul 10, 2017 in Q2A Core by john123
closed Jul 14, 2017 by john123
How to disable Q&A page in admin

Check out this screenshot. - http://prntscr.com/ftr7qy

I want to disable that page completely. I can't find it in qa-page.php

domain.com/qa - this url leads to recent questions. I want to remove this page from core.

(I know you can deselect and hide it but it does not remove from accessing directly from browser.)

Thanks for your help.
Q2A version: Latest
closed with the note: Thanks
commented Jul 10, 2017 by Scott
Do you have something else set as the home page?
commented Jul 11, 2017 by john123
Thanks for your reply.

domain.com/qa url remains access using browser when you use custom content on home page in admin/layout section.

Is there any page like qa.php (like qa-feed.php). How can i disable that. how can i disable default.php page without error?

I am trying to disable all list pages other than user's own post lists.

Thanks for your help

1 Answer

+1 vote
answered Jul 11, 2017 by Scott
selected Jul 14, 2017 by john123
Best answer

Currently there is no feature in Q2A to hide pages. Deselecting the page in options only hides the menu item. It is something that has been suggested before though so there may be more control in the future.

However you can remove the page with a core hack. The file for the home page is qa-include/pages/default.php but that also contains stuff for categories and custom pages. Look for this comment:

// If we got this far, it's a good old-fashioned Q&A listing page

Then you'll need to add this line:

return include QA_INCLUDE_DIR . 'qa-page-not-found.php';

If you want to block the /qa page and the default category pages (example.com/categoryname) put that line above the comment. To block /qa only, put that line inside the next "else" clause after that comment, around line 137 like this:

} else {
    return include QA_INCLUDE_DIR . 'qa-page-not-found.php';
    $sometitle = qa_lang_html('main/recent_qs_as_title');
    $nonetitle = qa_lang_html('main/no_questions_found');

That will make a 404 page on the "recent questions and answers" page.

commented Jul 11, 2017 by john123
Thank you for your reply.

I changed the line in default.php  for /qa page and categorymeta and it worked. It cant be accessible via browse directly.

Thank you for your help.