ユーザ用ツール

サイト用ツール


serverapps:dokuwiki:lighttpd:rewriteurl

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

次のリビジョン
前のリビジョン
serverapps:dokuwiki:lighttpd:rewriteurl [2022/07/01 08:13] – 作成 hayashiserverapps:dokuwiki:lighttpd:rewriteurl [2022/07/01 08:24] (現在) hayashi
行 1: 行 1:
 ====== urlの書き換え ====== ====== urlの書き換え ======
 +DokuWiki のデフォルト設定では URL を書き換えず、URL はこんな感じになります:
 +  http://example.com/doku.php?id=page
  
 +これを以下のようなurlになるよう変更します
 +
 +  http://example.com/page
 +
 +===== 設定 =====
 +- dokuwiki関連用設定ファイルに以下を追記
 +    * <file conf /usr/local/etc/dokuwiki/lighttpd.conf>
 +# rewrites for dokuwiki
 +$HTTP["url"] =~ "^/" { index-file.names = ("doku.php") }
 +url.rewrite-once = (
 +  "^/lib/.*$"                     => "$0",
 +  "^/_media/(.*)?\?(.*)$"         => "/lib/exe/fetch.php?media=$1&$2",
 +  "^/_media/(.*)$"                => "/lib/exe/fetch.php?media=$1",
 +  "^/_detail/(.*)?\?(.*)$"        => "/lib/exe/detail.php?media=$1&$2",
 +  "^/_detail/(.*)?$"              => "/lib/exe/detail.php?media=$1",
 +  "^/_export/([^/]+)/(.*)\?(.*)$" => "/doku.php?do=export_$1&id=$2&$3",
 +  "^/_export/([^/]+)/(.*)"        => "/doku.php?do=export_$1&id=$2",
 +  "^/doku.php.*"                  => "$0",
 +  "^/feed.php.*"                  => "$0",
 +  "^/(.*)\?(.*)"                  => "/doku.php?id=$1&$2",
 +  "^/(.*)"                        => "/doku.php?id=$1"
 +)</file> 
 +
 +- lighttpdのモジュール設定ファイルでrewriteモジュールを設定
 +    * <file conf /usr/local/etc/lighttpd/modules.conf>
 +server.modules = (
 +  "mod_rewrite",  <= コメントを外して生かす
 +  "mod_access",
 +#  "mod_evasive",
 +#  "mod_auth",
 +#  "mod_authn_file",
 +#  "mod_redirect",
 +#  "mod_setenv",
 +#  "mod_alias",
 +)</file> 
 +
 +===== 設定 =====
 +dokuwikiの設定画面で以下の設定を行います
 +  * URLの書き換え: .htaccess
 +  * URL上の名前空間の区切りにスラッシュを使用 [x]
 +
 +===== lighttpdの再起動 =====
 +
 +  service lighttpd restart
 +
 +
 +===== 参考 =====
 +  * [[https://www.dokuwiki.org/install:lighttpd_config_example|Lighttpd example config]]
serverapps/dokuwiki/lighttpd/rewriteurl.1656663235.txt.gz · 最終更新: 2022/07/01 08:13 by hayashi