Score:0

apache2 mod_rewrite rule error (although i think i did everything correctly, and have exhausted google's searchresults)

in flag

this rewrite rule is not hitting it's mark :(

    RewriteCond %{REQUEST_METHOD} ^(GET)$
    RewriteRule ^/wiki-search/(.+)$ NicerAppWebOS/index.php?app-wikipedia.org-search=$1 [L,END,PT,DPI]

apache log (with rewrite:trace6 set in apache sites-enabled config) :

[Tue Aug 29 06:30:46.281647 2023] [rewrite:trace3] [pid 2760088] mod_rewrite.c(480): [client 192.168.178.29:45136] 192.168.178.29 - - [192.168.178.29/sid#7ff3a4331d20][rid#7ff3a438f0a0/initial] [perdir /var/www/192.168.178.29/] add path info postfix: /var/www/192.168.178.29/wiki-search -> /var/www/192.168.178.29/wiki-search/john
[Tue Aug 29 06:30:46.281648 2023] [rewrite:trace3] [pid 2760088] mod_rewrite.c(480): [client 192.168.178.29:45136] 192.168.178.29 - - [192.168.178.29/sid#7ff3a4331d20][rid#7ff3a438f0a0/initial] [perdir /var/www/192.168.178.29/] strip per-dir prefix: /var/www/192.168.178.29/wiki-search/john -> wiki-search/john
[Tue Aug 29 06:30:46.281650 2023] [rewrite:trace3] [pid 2760088] mod_rewrite.c(480): [client 192.168.178.29:45136] 192.168.178.29 - - [192.168.178.29/sid#7ff3a4331d20][rid#7ff3a438f0a0/initial] [perdir /var/www/192.168.178.29/] applying pattern '^/wiki-search/(.+)$' to uri 'wiki-search/john'
[Tue Aug 29 06:30:46.281651 2023] [rewrite:trace3] [pid 2760088] mod_rewrite.c(480): [client 192.168.178.29:45136] 192.168.178.29 - - [192.168.178.29/sid#7ff3a4331d20][rid#7ff3a438f0a0/initial] [perdir /var/www/192.168.178.29/] add path info postfix: /var/www/192.168.178.29/wiki-search -> /var/www/192.168.178.29/wiki-search/john
[Tue Aug 29 06:30:46.281652 2023] [rewrite:trace3] [pid 2760088] mod_rewrite.c(480): [client 192.168.178.29:45136] 192.168.178.29 - - [192.168.178.29/sid#7ff3a4331d20][rid#7ff3a438f0a0/initial] [perdir /var/www/192.168.178.29/] strip per-dir prefix: /var/www/192.168.178.29/wiki-search/john -> wiki-search/john
[Tue Aug 29 06:30:46.281654 2023] [rewrite:trace3] [pid 2760088] mod_rewrite.c(480): [client 192.168.178.29:45136] 192.168.178.29 - - [192.168.178.29/sid#7ff3a4331d20][rid#7ff3a438f0a0/initial] [perdir /var/www/192.168.178.29/] applying pattern '^/wiki-search/(.+)$' to uri 'wiki-search/john'
[Tue Aug 29 06:30:46.281655 2023] [rewrite:trace3] [pid 2760088] mod_rewrite.c(480): [client 192.168.178.29:45136] 192.168.178.29 - - [192.168.178.29/sid#7ff3a4331d20][rid#7ff3a438f0a0/initial] [perdir /var/www/192.168.178.29/] add path info postfix: /var/www/192.168.178.29/wiki-search -> /var/www/192.168.178.29/wiki-search/john
[Tue Aug 29 06:30:46.281656 2023] [rewrite:trace3] [pid 2760088] mod_rewrite.c(480): [client 192.168.178.29:45136] 192.168.178.29 - - [192.168.178.29/sid#7ff3a4331d20][rid#7ff3a438f0a0/initial] [perdir /var/www/192.168.178.29/] strip per-dir prefix: /var/www/192.168.178.29/wiki-search/john -> wiki-search/john

i'm running on Ubuntu 22.04, with the latest apache2 :

root@parakeet:/var/www/192.168.178.29/NicerAppWebOS/scripts.maintenance# apache2 -v
Server version: Apache/2.4.52 (Ubuntu)
Server built:   2023-05-03T20:02:51

and i could really use some mod-rewrite expert help here..

for a demo of the app, see https://nicer.app/wiki/en.wikipedia.org - the search bar doesn't work yet... :(

in flag
RewriteRule ^/wiki-search/(.+)$ should be RewriteRule ^wiki-search/(.+)$ instead. but now i've got a different problem with mod_rewrite - it won't pass the GET HTTP parameters to my PHP script.. any ideas to solve this will be most welcome.
Score:1
in flag

ah! some google-ing (and following my own comment in my OP) helped :D

    RewriteCond %{REQUEST_METHOD} ^(GET)$
    RewriteCond %{HTTP:X-Requested-With} XMLHttpRequest
    RewriteRule ^wiki-search/(.*)$ NicerAppWebOS/logic.AJAX/ajax_get_content.php?app-wikipedia.org-search=$1&%{QUERY_STRING} [L]

    RewriteCond %{REQUEST_METHOD} ^(GET)$
    RewriteRule ^wiki-search/(.*)$ NicerAppWebOS/index.php?app-wikipedia.org-search=$1&%{QUERY_STRING} [L]

mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.