Welcome to the Question2Answer Q&A. There's also a demo if you just want to try it out.
+1 vote
984 views
in Q2A Core by

 

I'm transitioning from PHPBB to Q2A. I have imported users and mapped topics in PHPBB to categories in Q2A. The Q2A is a brilliant platform. 
 
Been looking around for an answer to a specific URL challenge.
 
The struture would like to use on Q2A is much more category oriented than page meaning the main menu is actually categories and not pages.
 
The URL structure I'm currently using is the one with <domain>/<questionid>/<title> but what I'm really after is <domain>/<category>/<title>-pid<questionid>
 
I tried to change the .htaccess file to take care of the change like so:
RewriteRule ^([a-z-]+)/([a-z-]+)-pid(\d+) index.php?qa-rewrite=$3/$2&%{QUERY_STRING} [L]
 
I've made changes to qa-base -> qa_q_request to get the URL return $category.'/'.$title.'-pid'.(int)$questionid; (the category should be passed as 3rd parameter but for now it's just hard coded) to return the desired URL.
 
But when clicking on links that have the correct format the result is an empty result.
 
What would be the best way to achieve the desired result and not wreak too much havoc in the core code?

 

Q2A version: 1.5.3

1 Answer

0 votes
by

To generalize your problem, you want to perform an arbitrary mapping between public URLs, and Q2A's internal paths. The best way to achieve this is with a plugin that overrides the functions qa_path(...) and qa_set_request(....).

Your qa_path(...) function should map $request from internal paths to public URLs before calling through to the base function. Your qa_set_request(...) function should map in the other direction, again calling the base function.

I've never actually tried this, so please let me know how you get on.

...