Created
August 12, 2011 06:52
-
-
Save ryuone/1141596 to your computer and use it in GitHub Desktop.
mod_rewrite(.htaccess)の設定
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # | |
| # Apacheのモジュール mod_rewriteを有効にする。(Ubuntu:sudo a2enmod rewrite) | |
| # | |
| RewriteEngine on # 1) | |
| RewriteRule ^([0-9\-]+)\.html$ index.fcgi?date=$1 # 2) | |
| # | |
| # http://www.ryuone.com/diary/20110806.html | |
| # でアクセスした場合、2)で | |
| # http://www.ryuone.com/diary/index.fcgi?date=20110806 | |
| # という形式でアクセスします。 | |
| # ブラウザには | |
| # http://www.ryuone.com/diary/20110806.html | |
| # のまま。 | |
| # | |
| # 例) | |
| # RewriteRule ^([a-zA-Z0-9\-]+)\/([a-zA-Z0-9\-]+)\/(.*)\.html$ $1_$2_$3.txt | |
| # をドキュメントルートの.htaccessに記述すると、 | |
| # | |
| # http://www.ryuone.com/a/b/りゅう.html | |
| # | |
| # にアクセスした場合、http://www.ryuone.com/a_b_りゅう.txt | |
| # にアクセスしたのと同じになる。(文字コード注意~) | |
| # |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment