1##
2# phpMyFAQ .htaccess file for Apache 2.x
3#
4# This Source Code Form is subject to the terms of the Mozilla Public License,
5# v. 2.0. If a copy of the MPL was not distributed with this file, You can
6# obtain one at http://mozilla.org/MPL/2.0/.
7#
8# @author    Thorsten Rinne <thorsten@phpmyfaq.de>
9# @author    Patrick Preuster <sica@php-q.net>
10# @author    Matteo Scaramuccia <matteo@scaramuccia.com>
11# @copyright 2004-2020 phpMyFAQ Team
12# @license   http://www.mozilla.org/MPL/2.0/ Mozilla Public License Version 2.0
13# @link      https://www.phpmyfaq.de
14# @since     2004-11-13
15
16# always follow the symlinks
17Options +FollowSymlinks -MultiViews -Indexes
18
19# X-Frame-Options to prevent clickjacking
20Header always append X-Frame-Options SAMEORIGIN
21
22# if you want to use mod_rewrite, set this 'On'
23RewriteEngine On
24
25<IfModule mod_fcgid.c>
26    RewriteCond %{HTTP:Authorization} .
27    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
28</IfModule>
29
30# the path to your phpMyFAQ installation
31RewriteBase /
32
33# Error pages
34ErrorDocument 404 /index.php?action=404
35
36# show all categories
37RewriteCond %{REQUEST_URI}          /showcat\.html$ [NC]
38RewriteRule ^(.*)$                  index.php?action=show [L,QSA]
39
40# the search page
41RewriteCond %{REQUEST_URI}          /search\.html$ [NC]
42RewriteRule ^(.*)$                  index.php?action=search [L,QSA]
43
44# opensearch
45RewriteCond %{REQUEST_URI}          /opensearch\.xml [NC]
46RewriteRule ^(.*)$                  opensearch.php [L,QSA]
47
48# the add content page
49RewriteCond %{REQUEST_URI}          /addcontent\.html$ [NC]
50RewriteRule ^(.*)$                  index.php?action=add [L,QSA]
51
52# the ask question page
53RewriteCond %{REQUEST_URI}          /ask\.html$ [NC]
54RewriteRule ^(.*)$                  index.php?action=ask [L,QSA]
55
56# the open questions page
57RewriteCond %{REQUEST_URI}          /open-questions\.html$ [NC]
58RewriteRule ^(.*)$                  index.php?action=open-questions [L,QSA]
59
60# the help page
61RewriteCond %{REQUEST_URI}          /help\.html$ [NC]
62RewriteRule ^(.*)$                  index.php?action=help [L,QSA]
63
64# the contact page
65RewriteCond %{REQUEST_URI}          /contact\.html$ [NC]
66RewriteRule ^(.*)$                  index.php?action=contact [L,QSA]
67
68# the glossary page
69RewriteCond %{REQUEST_URI}          /glossary\.html$ [NC]
70RewriteRule ^(.*)$                  index.php?action=glossary [L,QSA]
71
72# the overview page
73RewriteCond %{REQUEST_URI}          /overview\.html$ [NC]
74RewriteRule ^(.*)$                  index.php?action=overview [L,QSA]
75
76# the login page
77RewriteCond %{REQUEST_URI}          /login\.html$ [NC]
78RewriteRule ^(.*)$                  index.php?action=login [L,QSA]
79
80# start page
81RewriteRule ^index.html$            index.php [PT]
82
83# a solution id page
84RewriteCond %{REQUEST_URI}              solution_id_([0-9]+)\.html$ [NC]
85RewriteRule ^solution_id_(.*)\.html$    index.php?solution_id=$1 [L,QSA]
86
87# PMF faq record page
88# * http://[...]/content/1/1/<LANGUAGE CODE>/<FAQ TOPIC>.htm
89# * http://[...]/content/1/1/<LANGUAGE CODE>/<FAQ TOPIC>.html
90RewriteRule content/([0-9]+)/([0-9]+)/([a-z\-]+)/(.+)\.htm(l?)$     index.php?action=faq&cat=$1&id=$2&artlang=$3 [L,QSA]
91
92# PMF category page with page count
93# * http://[...]/category/1/<PAGE NUMBER/<CATEGORY NAME>.htm
94# * http://[...]/category/1/<PAGE NUMBER/<CATEGORY NAME>.html
95RewriteRule category/([0-9]+)/([0-9]+)/(.+)\.htm(l?)$               index.php?action=show&cat=$1&seite=$2 [L,QSA]
96
97# PMF category page
98# * http://[...]/category/1/<CATEGORY NAME>.htm
99# * http://[...]/category/1/<CATEGORY NAME>.html
100RewriteRule category/([0-9]+)/(.+)\.htm(l?)$                        index.php?action=show&cat=$1 [L,QSA]
101
102# PMF news page
103# * http://[...]/news/<ID>/<LANGUAGE CODE>/<HEADER>.htm
104# * http://[...]/news/<ID>/<LANGUAGE CODE>/<HEADER>.html
105RewriteRule news/([0-9]+)/([a-z\-]+)/(.+)\.htm(l?)$                 index.php?action=news&newsid=$1&newslang=$2 [L,QSA]
106
107# PMF sitemap
108# * http://[...]/sitemap/<LETTER>/<LANGUAGE CODE>.htm
109# * http://[...]/sitemap/<LETTER>/<LANGUAGE CODE>.html
110RewriteRule sitemap/([^\/]+)/([a-z\-]+)\.htm(l?)$                   index.php?action=sitemap&letter=$1&lang=$2 [L,QSA]
111
112# PMF Google sitemap
113# * http://[...]/sitemap.xml
114# * http://[...]/sitemap.gz
115# * http://[...]/sitemap.xml.gz
116RewriteRule sitemap.xml$                                            sitemap.xml.php [L]
117RewriteRule sitemap.gz$                                             sitemap.xml.php?gz=1 [L]
118RewriteRule sitemap.xml.gz$                                         sitemap.xml.php?gz=1 [L]
119
120# PMF tags page with page count
121# * http://[...]/tags/<ID>/<PAGE NUMBER>/<HEADER>.htm
122RewriteRule tags/([0-9]+)/([0-9]+)/(.+)\.htm(l?)$                   index.php?action=search&tagging_id=$1&seite=$2 [L,QSA]
123
124# PMF tags page
125# * http://[...]/tags/<ID>/<HEADER>.htm
126RewriteRule tags/([0-9]+)/([^\/]+)\.htm(l?)$                        index.php?action=search&tagging_id=$1 [L,QSA]
127
128# REST/JSON API v1
129# * http://[...]/api/<ACTION>/<LANGUAGE CODE>/<...>
130# @deprecated These APIs will be removed in phpMyFAQ 3.1
131RewriteRule api/getVersion                                  api.php?action=getVersion [L,QSA]
132RewriteRule api/getApiVersion                               api.php?action=getApiVersion [L,QSA]
133RewriteRule api/getCount                                    api.php?action=getCount [L,QSA]
134RewriteRule api/getDefaultLanguage                          api.php?action=getDefaultLanguage [L,QSA]
135RewriteRule api/search/([a-z\-]+)/([a-z\-]+)$               api.php?action=search&lang=$1&q=$2 [L,QSA]
136RewriteRule api/getCategories/([a-z\-]+)                    api.php?action=getCategories&lang=$1 [L,QSA]
137RewriteRule api/getFaqs/([a-z\-]+)/([0-9]+)                 api.php?action=getFaqs&lang=$1&categoryId=$2 [L,QSA]
138RewriteRule api/getFaq/([a-z\-]+)/([0-9]+)                  api.php?action=getFaq&lang=$1&recordId=$2 [L,QSA]
139RewriteRule api/getComments/([0-9]+)                        api.php?action=getComments&recordId=$1 [L,QSA]
140RewriteRule api/getAllFaqs/([a-z\-]+)                       api.php?action=getAllFaqs&lang=$1 [L,QSA]
141RewriteRule api/getFaqAsPdf/([a-z\-]+)/([0-9]+)/([0-9]+)    api.php?action=getFaqAsPdf&lang=$1&categoryId=$2&recordId=$3 [L,QSA]
142RewriteRule api/getAttachmentsFromFaq/([a-z\-]+)/([0-9]+)   api.php?action=getAttachmentsFromFaq&lang=$1&recordId=$2 [L,QSA]
143RewriteRule api/getPopular/([a-z\-]+)                       api.php?action=getPopular&lang=$1 [L,QSA]
144RewriteRule api/getLatest/([a-z\-]+)                        api.php?action=getLatest&lang=$1 [L,QSA]
145RewriteRule api/getNews/([a-z\-]+)                          api.php?action=getNews&lang=$1 [L,QSA]
146RewriteRule api/getPopularSearches/([a-z\-]+)               api.php?action=getPopularSearches&lang=$1 [L,QSA]
147RewriteRule api/getPopularTags                              api.php?action=getPopularTags [L,QSA]
148RewriteRule api/getFAQsByTag/([a-z\-]+)/([0-9]+)            api.php?action=getFAQsByTag&lang=$1&tagId=$2 [L,QSA]
149RewriteRule api/login                                       api.php?action=login [L,QSA]
150
151# REST API v2.0
152# * http://[...]/api/v2.0/<ACTION>
153RewriteRule api/v2.0/version                       api.php?action=version [L,QSA]
154RewriteRule api/v2.0/language                      api.php?action=language [L,QSA]
155RewriteRule api/v2.0/categories                    api.php?action=categories [L,QSA]
156RewriteRule api/v2.0/searches/popular              api.php?action=searches&filter=popular [L,QSA]
157RewriteRule api/v2.0/search                        api.php?action=search [L,QSA]
158RewriteRule api/v2.0/tags                          api.php?action=tags [L,QSA]
159RewriteRule api/v2.0/open-questions                api.php?action=open-questions [L,QSA]
160RewriteRule api/v2.0/comments/([0-9]+)             api.php?action=comments&recordId=$1 [L,QSA]
161RewriteRule api/v2.0/attachments/([0-9]+)          api.php?action=attachments&recordId=$1 [L,QSA]
162RewriteRule api/v2.0/news                          api.php?action=news [L,QSA]
163RewriteRule api/v2.0/login                         api.php?action=login [L,QSA]
164RewriteRule api/v2.0/faqs/([0-9]+)                 api.php?action=faqs&categoryId=$1 [L,QSA]
165RewriteRule api/v2.0/faqs/popular                  api.php?action=faqs&filter=popular [L,QSA]
166RewriteRule api/v2.0/faqs/latest                   api.php?action=faqs&filter=latest [L,QSA]
167RewriteRule api/v2.0/faqs/sticky                   api.php?action=faqs&filter=sticky [L,QSA]
168RewriteRule api/v2.0/faqs/tags/([0-9]+)            api.php?action=faqs&tagId=$1 [L,QSA]
169RewriteRule api/v2.0/faqs                          api.php?action=faqs [L,QSA]
170RewriteRule api/v2.0/faq/([0-9]+)/([0-9]+)         api.php?action=faq&categoryId=$1&recordId=$2 [L,QSA]
171
172# REST API v2.1 - not implemented yet
173# * http://[...]/api/v2.1/<ACTION>
174RewriteRule api/v2.1/register                      api.php?action=register [L,QSA]
175