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);
?>
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);
?>
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]
動的なContent-Typeの変更
RewriteEngine on
RewriteRule .* - “[T=application/xhtml+xml; charset=utf-8]”
PHPで動的なContent-Typeの設定が出来なくて、あたふたして色々調べていたら
『動的なContent-Typeヘッダをmod_layoutに認識させる』
http://module.jp/blog/support_to_dynamic_content_type_in_mod_layout.html
との事です。
mod_layout使ってました・・・商用サーバーの設定はなかなか変えられないのでとりあえず保留
mod_rewriteでなんとかならないかな?