Skip to content

DokuWiki SEO Configuration — URLs, Meta Tags, Sitemaps, and Search Engine Optimization

DodaTech Updated 2026-06-28 7 min read

In this tutorial, you'll learn how to optimize DokuWiki for search engines, including clean URL configuration, meta tags and descriptions, XML sitemap generation, robots.txt, and SEO plugin integration.

What You'll Learn

  • Configuring clean URLs for better indexing
  • Adding meta tags and descriptions to pages
  • Generating XML sitemaps
  • Configuring robots.txt
  • SEO plugin integration
  • Page title optimization
  • Internal linking for SEO

Why It Matters

DokuWiki's default configuration is not SEO-friendly. URLs contain query parameters, pages lack meta descriptions, and there is no sitemap. Without SEO optimization, search engines struggle to index your content. Proper SEO means your wiki pages appear in search results, driving organic traffic without paid advertising.

Real-World Use

A public documentation wiki implements SEO improvements: clean URLs (/wiki/docs/installation instead of /wiki/doku.php?id=docs:installation), meta descriptions on every page, automatically generated sitemaps submitted to Google Search Console, and internal linking with descriptive anchor text. Within 3 months, organic search traffic increases by 200%. Developers searching for installation help find the wiki on the first page of Google results.

Learning Path

flowchart LR
  A[Caching] --> B[SEO]
  B --> C[Multi-Language]
  C --> D[CLI Tools]
  D --> E[API]
  E --> F[Backup]

Clean URLs

By default, DokuWiki URLs look like:

http://yourserver/wiki/doku.php?id=projects:roadmap

Clean URLs improve readability and SEO:

http://yourserver/wiki/projects:roadmap

Enabling Clean URLs

<?php
// conf/local.php
$conf['userewrite'] = 1;    // Enable clean URLs

Rewrite Modes

Mode Description URL Example
0 Default (ugly) /doku.php?id=page
1 Apache mod_rewrite /page
2 PHP internal /doku.php/page

Apache Configuration

Ensure .htaccess has rewrite rules enabled:

RewriteEngine on
RewriteRule ^_media/(.*)              lib/exe/fetch.php?media=$1  [QSA,L]
RewriteRule ^_detail/(.*)             lib/exe/detail.php?media=$1 [QSA,L]
RewriteRule ^_export/([^/]+)/(.*)     doku.php?do=export_$1&id=$2 [QSA,L]
RewriteRule ^$                        doku.php                       [QSA,L]
RewriteCond %{REQUEST_FILENAME}       !-f
RewriteCond %{REQUEST_FILENAME}       !-d
RewriteRule ^(.*)                     doku.php?id=$1                 [QSA,L]

Nginx Configuration

location / {
    try_files $uri $uri/ @dokuwiki;
}

location @dokuwiki {
    rewrite ^/_media/(.*) /lib/exe/fetch.php?media=$1 last;
    rewrite ^/_detail/(.*) /lib/exe/detail.php?media=$1 last;
    rewrite ^/_export/([^/]+)/(.*) /doku.php?do=export_$1&id=$2 last;
    rewrite ^/(.*) /doku.php?id=$1 last;
}

Meta Tags and Descriptions

Adding Meta Description to Pages

DokuWiki does not add meta descriptions by default. Use a plugin or add to your template:

<?php
// In template's main.php, within <head>
if ($ACT === 'show' && $INFO['exists']) {
    // Use first paragraph as meta description
    $metaDesc = p_get_metadata($ID, 'description');
    echo '<meta name="description" content="' . hsc($metaDesc['abstract']) . '">';
}

The Meta Plugin

Install the Meta plugin for per-page meta tags:

cd /var/www/html/wiki/lib/plugins/
wget https://github.com/username/dokuwiki-plugin-meta/archive/master.zip
unzip master.zip
mv dokuwiki-plugin-meta-master meta

Usage in a page:

~~META:description=Learn how to install and configure DokuWiki on Ubuntu 22.04~~
~~META:keywords=dokuwiki, installation, ubuntu, wiki~~

Page Titles

Page titles are derived from the first heading. Use descriptive headings:

====== Installing DokuWiki on Ubuntu 22.04 — Step-by-Step Guide ======

This becomes the HTML <title> tag, which is the most important SEO element.

XML Sitemaps

DokuWiki does not generate XML sitemaps natively. Use a plugin or script.

Sitemap Plugin

cd /var/www/html/wiki/lib/plugins/
wget https://github.com/username/dokuwiki-plugin-sitemap/archive/master.zip
unzip master.zip
mv dokuwiki-plugin-sitemap-master sitemap

Manual Sitemap Script

<?php
// sitemap-generator.php - Run from command line
require_once('inc/init.php');

$pages = array();
search($pages, $conf['datadir'], 'search_allpages', array());

$xml = '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
$xml .= '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">' . "\n";

foreach ($pages as $page) {
    $id = $page['id'];
    $url = wl($id, '', true);
    $xml .= '  <url>' . "\n";
    $xml .= '    <loc>' . hsc($url) . '</loc>' . "\n";
    $xml .= '    <lastmod>' . date('c', filemtime($page['file'])) . '</lastmod>' . "\n";
    $xml .= '    <priority>0.5</priority>' . "\n";
    $xml .= '  </url>' . "\n";
}

$xml .= '</urlset>' . "\n";

file_put_contents('sitemap.xml', $xml);
echo "Sitemap generated with " . count($pages) . " URLs.\n";

Submit the sitemap to Google Search Console.

robots.txt

Create or edit robots.txt in your DokuWiki root:

User-agent: *
Allow: /
Disallow: /doku.php?do=admin
Disallow: /doku.php?do=edit
Disallow: /doku.php?do=login
Disallow: /doku.php?do=register
Disallow: /doku.php?do=index
Disallow: /doku.php?do=recent
Disallow: /doku.php?do=media
Disallow: /lib/
Disallow: /conf/
Disallow: /inc/
Disallow: /vendor/

Sitemap: https://yourserver.com/sitemap.xml

SEO Plugins

SEO Plugin

The SEO plugin adds meta tags, Open Graph tags, and Twitter Card support.

Configuration:

<?php
$conf['plugin']['seo']['opengraph'] = 1;
$conf['plugin']['seo']['twitter_cards'] = 1;
$conf['plugin']['seo']['auto_description'] = 1;
$conf['plugin']['seo']['auto_keywords'] = 1;

Google Analytics Integration

<?php
// In template's main.php, before closing </head>
<?php if ($conf['plugin']['ga']['tracking_id']): ?>
<script async src="https://www.googletagmanager.com/gtag/js?id=<?php echo hsc($conf['plugin']['ga']['tracking_id']) ?>"></script>
<script>
  window.dataLayer = window.dataLayer || [];
  function gtag(){dataLayer.push(arguments);}
  gtag('js', new Date());
  gtag('config', '<?php echo hsc($conf['plugin']['ga']['tracking_id']) ?>');
</script>
<?php endif; ?>

Internal Linking for SEO

Descriptive Anchor Text

Use descriptive link text instead of generic phrases:

<!-- Bad for SEO -->
Click here for installation instructions.

<!-- Good for SEO -->
Follow the [[docs:installation|Ubuntu installation guide]] for setup instructions.

Link related pages together to create topic clusters. A page about installation should link to configuration, requirements, and troubleshooting pages.

Avoid Orphan Pages

Every page should be linked from at least one other page. Orphan pages are not crawled by search engines.

Common Mistakes

  1. Not enabling clean URLs: Default URLs with doku.php?id= are indexed but look unprofessional. Clean URLs improve click-through rates from search results.
  2. Missing meta descriptions: Google often uses meta descriptions as search snippets. Without them, Google auto-generates snippets that may not match your content.
  3. Blocking CSS and JS in robots.txt: Some SEO guides recommend blocking CSS/JS, but Google needs them for rendering. Do not block them.
  4. Duplicate content from multiple URLs: DokuWiki can serve the same page at multiple URLs. Use canonical URLs to prevent duplicate content penalties.
  5. Ignoring mobile optimization: Google uses mobile-first indexing. Ensure your template is responsive and works well on mobile devices.

Practice Questions

  1. How do you enable clean URLs in DokuWiki, and what is required on Apache vs Nginx?
  2. What is the most important SEO element in a DokuWiki page, and how is it derived?
  3. How would you generate and submit an XML sitemap for a DokuWiki site?
  4. Challenge: Perform a complete SEO audit of a DokuWiki site. Check: clean URLs are enabled, meta descriptions exist on at least 80% of pages, page titles are descriptive and unique, sitemap is generated and submitted to Google Search Console, robots.txt is configured correctly, internal links use descriptive anchor text, pages load in under 2 seconds on mobile, and Open Graph tags are configured. Document each finding with a fix if needed. Implement at least 5 improvements and measure the impact on search visibility.

FAQ

Does DokuWiki generate meta descriptions automatically?

No. You must use a plugin (like SEO or Meta) or add logic in your template to generate meta descriptions from page content. Without these, pages have no meta description tag.

How do I submit my DokuWiki sitemap to Google?

Add your site to Google Search Console, verify ownership, and submit the sitemap URL (https://yourserver.com/sitemap.xml) in the Sitemaps section. Google will crawl and index the URLs listed.

Can I use custom page slugs instead of page IDs in URLs?

DokuWiki uses page IDs in URLs. There is no built-in slug system. You can use a rewrite plugin or configure your web server to rewrite short URLs to full page IDs for specific pages.

How do I prevent search engines from indexing private namespaces?

Use robots.txt to disallow specific paths, or (more securely) rely on ACL permissions. Search engines cannot access pages that require authentication. Using ACL is more secure than robots.txt.

Does DokuWiki support Open Graph tags?

Not natively. The SEO plugin adds Open Graph and Twitter Card support. These tags control how pages appear when shared on social media platforms like Facebook, Twitter, and LinkedIn.

Mini Project

Goal: Fully optimize a DokuWiki site for search engines.

  1. Enable clean URLs (mode 1 with Apache or Nginx rewrite)
  2. Install and configure the SEO plugin for meta tags and Open Graph
  3. Generate an XML sitemap
  4. Create or update robots.txt
  5. Ensure every page has a descriptive title (first heading)
  6. Review internal links and fix orphan pages
  7. Test mobile responsiveness of the template
  8. Submit the sitemap to Google Search Console
  9. Measure organic traffic before and after (allow 4 weeks for results)

What's Next

SEO makes your wiki discoverable. Now learn about multi-language wiki support for international audiences.

Built by the developers of DodaTech

Doda Browser, DodaZIP & Durga Antivirus Pro