DroidOS
DroidOS

Reputation: 8890

.htaccess rewrite to add query parameter

I need to modify all requests bearing the form

http://example.com/dw2/dokuwiki/doku.php/page to

http://example.com/dw2/dokuwiki/doku.php/page?do=export_xhtml

The page bit is variable - it corresponds to each paage in the wiki. I should mention that given the way dokuwiki syntax works page could contain one or more colons. e.g. glossary:archive.

The intent here is to extract the bare page content (shorn of the header, sidebar etc) of the wiki for distribution via a CDN. This does not give a complete solution since dokuwiki still leaves in a lot of unrequired verbiage in the exported markup file but gets me most of the way there. I'd much appreciate any help with this.

Upvotes: 1

Views: 54

Answers (1)

anubhava
anubhava

Reputation: 785196

Place this rule as your very first rule in /dw2/dokuwiki/.htaccess:

RewriteEngine On
RewriteBase /dw2/dokuwiki/

RewriteCond %{QUERY_STRING} ^$
RewriteRule ^(doku\.php/[^/]+)/?$ $1?do=export_xhtml [L,NC,QSA,R,NE]

Upvotes: 1

Related Questions