meta data for this page
  •  

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
wiki:dokuwiki-rewrite-rules [30/07/2023 08:05] – [Default rules explained] ztrulphcswiki:dokuwiki-rewrite-rules [30/07/2023 08:10] (current) – [Default rules explained] ztrulphcs
Line 50: Line 50:
 </code>Example and explanation: Given the URL ''%%http://example.com/_media/wiki:dokuwiki.png%%'' we have </code>Example and explanation: Given the URL ''%%http://example.com/_media/wiki:dokuwiki.png%%'' we have
     * ''^_media/(.*)'' that matches ''_media/wiki:dokuwiki.png''     * ''^_media/(.*)'' that matches ''_media/wiki:dokuwiki.png''
-    * The part corresponding to ''(.*)''((that means all the characters that are left. (after ''media/'') )) is associated with ''$1''. So ''$1'' is now ''wiki:wiki.png''.+      * The part corresponding to ''(.*)''((that means all the characters that are left. (after ''media/'') )) is associated with ''$1''. So ''$1'' is now ''wiki:wiki.png''.
     * it is rewritten as ''lib/exe/fetch.php?media=wiki:dokuwiki.png''     * it is rewritten as ''lib/exe/fetch.php?media=wiki:dokuwiki.png''
       * Note that for the ''?media=wiki:dokuwiki.png'' part to be effectively added to the URL, we have to use the ''[QSA]'' flag       * Note that for the ''?media=wiki:dokuwiki.png'' part to be effectively added to the URL, we have to use the ''[QSA]'' flag
Line 64: Line 64:
 </code>Example and explanation: This is almost the same as the preceding cases. The only difference is we have 2 groups of parentheses instead of 1. We'll have $1 and $2 as “variables”. So, given the URL ''%%http://example.com/_export/raw/wiki:syntax%%'' we have </code>Example and explanation: This is almost the same as the preceding cases. The only difference is we have 2 groups of parentheses instead of 1. We'll have $1 and $2 as “variables”. So, given the URL ''%%http://example.com/_export/raw/wiki:syntax%%'' we have
     * ''_export/([^/]+)/(.*)'' that matches ''_export/raw/wiki:syntax''     * ''_export/([^/]+)/(.*)'' that matches ''_export/raw/wiki:syntax''
-    * The part corresponding to ''([^/]*)''((that means the first word left after ''_export/'')) is associated with ''$1''. So ''$1'' is now ''raw''+      * The part corresponding to ''([^/]*)''((that means the first word left after ''_export/'')) is associated with ''$1''. So ''$1'' is now ''raw''
-    * The part corresponding to ''(.*)''((that means everything that's left (after ''_export/raw/'') )) is associated with ''$2''. So ''$2'' is now ''wiki:syntax''.+      * The part corresponding to ''(.*)''((that means everything that's left (after ''_export/raw/'') )) is associated with ''$2''. So ''$2'' is now ''wiki:syntax''.
     * it is rewritten as ''doku.php?do=export_raw&id=wiki:syntax''     * it is rewritten as ''doku.php?do=export_raw&id=wiki:syntax''
     * Note that for the ''?do=export_raw&id=wiki:syntax'' part to be effectively added to the URL, we have to use the ''[QSA]'' flag     * Note that for the ''?do=export_raw&id=wiki:syntax'' part to be effectively added to the URL, we have to use the ''[QSA]'' flag
Line 90: Line 90:
   - if the url/file is index.php, then use doku.php instead of index.php and continue with next rule, as there is no ''[L]'' flag.<code>   - if the url/file is index.php, then use doku.php instead of index.php and continue with next rule, as there is no ''[L]'' flag.<code>
 RewriteRule ^index.php$ doku.php RewriteRule ^index.php$ doku.php
-</code> +</code>It transforms <code>
-It transforms <code>+
 http://example.com/index.php<code>into http://example.com/index.php<code>into
 http://example.com/doku.php</code> http://example.com/doku.php</code>