13,009
回編集
99行目: | 99行目: | ||
Allow from env=example | Allow from env=example | ||
</Directory> | </Directory> | ||
</syntaxhighlight> | |||
<br><br> | |||
== リダイレクト == | |||
==== 一時リダイレクト ==== | |||
<syntaxhighlight lang="apache"> | |||
# httpd.confファイル | |||
# Redirect <アクセスするパス> <リダイレクト先のパスまたはURL> | |||
# これは、ステータスコード 302 (tmp) である | |||
# 以下の例では、http://example.com/redirect_sample/ にアクセスする場合、http://example.com/redirect/ にリダイレクトされる | |||
Redirect /redirect_sample/ http://example.com/redirect/ | |||
# アクセスするパスは正規表現を使用して指定することもできる | |||
# 以下の例は、http://example.com/redirect_sample/内のファイルにアクセスする場合は、全て http://example.com/redirect/ にリダイレクトされる | |||
Redirect ^/redirect_sample/(.*)$ http://example.com/redirect/ | |||
</syntaxhighlight> | |||
<br> | |||
==== 恒久リダイレクト ==== | |||
<syntaxhighlight lang="apache"> | |||
# httpd.confファイル | |||
# Redirect <ステータス> <アクセスするパス> <リダイレクト先のパスまたはURL> | |||
# これは、ステータスparmanent (ステータスコード 301 : Moved Parmanetly) を返す | |||
Redirect parmanent /redirect_sample/ http://example.com/redirect/ | |||
</syntaxhighlight> | </syntaxhighlight> | ||
<br><br> | <br><br> |