Manual:Short URL/ja
World Wide Webの考案者であるティム・バーナーズ=リーによれば、 良いウェブページアドレスは変わりません。[1] ウェブページアドレスバーから複雑なプログラミングコードを隠す短いウェブページアドレスはウェブページの訪問者に対してよいものです。
MediaWikiのデフォルトのウェブページアドレスは次のようなものになります:
http://example.com/wiki/index.php/Page_title(MediaWiki version 1.11.0) orhttp://example.com/wiki/index.php?title=Page_title
下記の方法を使用することで、ウェブページのアドレスを次のように短くすることができます:
http://example.com/Page_titlehttp://example.com/wiki/Page_titlehttp://wiki.example.com/Page_title
ウェブページアドレスを短くする方法はすぐに複雑になります。ですので"ハウトゥー"のミニガイドは下記でリスト表示されている個別のページで示すことにします。
Contents |
[edit] ルートアクセスの権限があるか無いか?
共有ホスティング: 共有ホストを利用している場合、サーバーのルートアクセス権限を持つことはないでしょう。恐らく下記のルートアクセステクニックを使うことはできません。最初にあなたのホスティングプロバイダーを訪問してください。そしてすべてのページで"index.php?title="を省略する方法をプロバイダーに尋ねれば問題が解決することがあります。
ルートアクセスの権限が無い場合、public_htmlフォルダに設置された.htaccessによってルートアクセス権限無しで書き換えることができます。 あなたのホスト次第で、.htaccessファイルでエイリアスもしくは書き換えルールを利用することができることもあります。
.htaccess もしくは httpd.confの両方ではなくどちらかを編集する必要があるだけです。選択肢があるのであれば、httpd.confを編集しますルートアクセス権限が要求されるhttpd.confを編集する方が望ましい方法です。こちらの方がwikiのパフォーマンスが良いからです。[1] 多くの共有ホスティングシステムではhttpd.confの編集は許可されていません。
- Apacheの記事の、いつ .htaccess ファイルを使う(使わない)か。をご覧ください。[2]
[edit] ショートURLの"ハウトゥー"のミニガイド
"ハウトゥー"の解決方法のページを作ることは誰でも歓迎します。そしてそれらのリストは下に示されています。 下記のような見分けのつくページ名を使ってください。それぞれの独自の解決方法が独自のページを持つとき、読者は望まない複雑な方法を読み飛ばすことができます。
シンプルで、読みやすく、短くするために個別の解決方法ごとにページを提供します。
|
ショートURLの方法が本当に動作するのかわかったら、試した後で次の項目の入力をお願いします:
|
[edit] Example.com/Page_title
作成方法: example.com/Page_title ウェブページアドレス
- Page title -- PHP as a CGI module, no root access
- Page title -- PHP as a CGI module, no root access
- Page title -- Aliasing method--Root access
- Page title -- Working method with mediawiki-1.11 used this method
- Page title -- solution zzz
[edit] Example.com/wiki/Page_title
作成方法: example.com/wiki/Page_title ウェブページアドレス
- wiki/Page title -- PHP as a CGI module, no root access
- wiki/Page title -- no root access
- wiki/Page title -- Both no root and root access
- wiki/Page title -- solution yyy---no root access
- wiki/Page title -- solution zzz---no root access
rootアクセス権限
以下の方法はサーバコンフィギュレーションへのアクセス権限が要求されます。共有ホスト上の場合、大抵は利用できません; 代わりに"no root access"の例をご覧ください。
- Page title--root access -- EASY
- wiki/Page title -- with aliases--root access
- wiki/Page title -- Apache rewrite--root access
Aliasの方法が適切ではない場合(例えば、PHPをCGIとして利用する場合)、Apacheを代わりに利用することができます。 - wiki/Page title -- Lighttpd rewrite--root access
- wiki/Page title -- solution yyy, root access
- wiki/Page title -- solution zzz, root access
[edit] Wiki.example.com/Page_title
作成方法: wiki.example.com/Page_title ウェブページアドレス
- wiki.example.com/Page_title -- EASY ?
- wiki.example.com/Page_title--difficult
- wiki.example.com/Page_title--Subdomain with no Subdirectory in Article URL
- wiki.example.com/Page_title--Subdomain using mod-rewrite
- wiki.example.com/Page_title--Subdomain using Lighttpd
- wiki.example.com/Page_title--Enabling a wiki using Apache Rewrite
- wiki.example.com/Page_title--solution zzz
- wiki.example.com/Page_title--solution xxx
- wiki.example.com/Page_title--solution yyy
[edit] アンパサンド(&)問題
説明: ページタイトルに特定の記号(&、?、#、+と/)が含まれる場合、リンクでは正しくエンコードされているにも関わらずmod_rewriteからスクリプトに正しく渡されない問題があります。これは404 page not found errorsになります。タイトルの特別な文字が省略されます。例えば"John & Maria's page"のリンクをクリックすることで404エラーになります。MediaWikiが"John "というページ名を探すからです [3]
解決方法:
- Ampersand solution with root access
- Ampersand semi-friendly solution with root access
- Ampersand --solution xxx
- Ampersand --solution yyy
[edit] トリック
- IIS6
- Prevent bots from crawling index.php
- Ignoring the Trailing slash
- Allowing for escaped characters in URI
[edit] トラブルシューティング
- 次のようなルーピングalias/rewriteエラーメッセージを受け取りました: 'Cannot find page www.example.com/wiki/wiki/wiki/wiki/wiki/ [...] /index.php'
解決方法: Manual:Short URL/Repeated directory errors
[edit] テクニカルノート
- ↑ httpdもしくはhtaccessのどちらを編集すべきか? httpd.confを編集するためのアクセス権限を要求されないのに加えて、.htaccessを編集する利点はディレクトリに対するRewriteRuleで言及されないすべてのディレクトリが外部から到達出来ないことです。しかしながら、httpdはディレクトリツリーを検索して適用するすべての.htaccessファイルを処理しなければならないのでパフォーマンスのペナルティがあります。
- ↑ 別途の通知があるまで、Apacheは次のURLのようにWikipediaの不細工で長いURLをシンプルで短いものに変換する(創造的な)書き換えをサポートします:
- http://localhost/index.php?title=Main_Page
- http://localhost/Main_Page.
- ↑ アンパサンド問題の理由: アンパサンド問題の理由は長い言葉で説明すると記事はそれらの名前にアンパサンドを持つことが出来ないことを意味します。なぜならそれらはクエリ文字列セパレータとして取り扱われPHPのランタイム環境に到達しないからです。the is Ampersands problemの原因は古くて問題のあるmod_rewriteのバグです。lists.wikimedia.orgとfgiasson.comで別の可能性の解決方法の議論があります。
[edit] 関連項目
- An explanation of what each Rewrite programming line does
- Explanation of what this means: PHP is run as CGI instead of as a direct module
- URL rewrite in IIS
- MediaWikiコンフィギュレーション変数のManual:$wgUsePathInfoによって'pretty' URLを使うかどうか設定できます。
[edit] 外部リンク
| 言語: | English • 日本語 • Русский • 中文(简体) |
|---|