ホーム
サポート
サービスご利用中
オンラインマニュアル
mod_rewriteの使い方
ホスティング(レンタルサーバー)は任せて安心OH!いいな[宮城県仙台市]

mod_rewriteは、URLを操作するための機能です。
特定のURLへのリクエストがあった場合、別のURLにの内容を返したり、動的なページを静的なページに見せかけることも可能です。
RewriteEngine On RewriteBase ベースとなるディレクトリ RewriteRule 検索パターン 置換文字列 オプション
RewriteEngine On RewriteBase / RewriteRule foo/(.*) bar/$1
RewriteEngine On RewriteBase / RewriteRule foo/(.*) bar/$1[R=301,L]
RewriteEngine On
RewriteBase /
RewriteCond %{HTTP_USER_AGENT} (DoCoMo|Vodafone|J-PHONE|SoftBank|UP\.Browser|KDDI)
RewriteCond %{REQUEST_URI} !^/m/
RewriteRule ^(.*)\.html$ m/$1.html [L]
RewriteEngine On RewriteBase / RewriteRule cgi-bin/(.*)/(.*)\.html$ cgi-bin/$1.cgi?opt=$2 [L]