‘mod_rewrite’ カテゴリーのアーカイブ

Rewriteで引数

2008 年 7 月 6 日 日曜日

RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^([0-9A-Za-z]+)/([0-9A-Za-z)]+)\.html$ index.php?var1=$1&var2=$2 [L]

【index.php】

<?php
print_r($_REQUEST);
?>

RewriteでPHPからHTML

2008 年 7 月 6 日 日曜日

RewriteEngine on
RewriteRule    ^$    /index.php    [L]
RewriteRule    ^([a-zA-Z0-9\-\_/]*)/$    /$1/index.php    [L]
RewriteRule    ^([a-zA-Z0-9\-\_/]*)\.(html|htm)$    /$1.php    [L]
RewriteRule    ^([a-zA-Z0-9\-\_/]*)$    /$1.php    [L]
RewriteRule    ^/date/([a-zA-Z0-9\-\_/]*)/index.php    /index.php?date=$1    [L]

Rewrite

2008 年 5 月 7 日 水曜日

動的なContent-Typeの変更

RewriteEngine on
RewriteRule .* - “[T=application/xhtml+xml; charset=utf-8]”