htaccessを使って、特定URLを404エラーにしたいです。
例えば、
http://example.com/aiueo.html
と
http://www.example.com/aiueo.html
を404にする場合、どのようにすれば良いでしょうか?
ただしこの時、
https://example.com/aiueo.html
は通常通り表示させたいです。
ちなみに、今現在、以下のようにしていますが、うまくいっていません。
RewriteEngine on
RedirectMatch 404 http://example.com/aiueo.html$1
RedirectMatch 404 http://www.example.com/aiueo.html$1
RewriteCond %{HTTPS} off
RewriteRule ^(.)$ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]
RewriteCond %{HTTP_HOST} ^www.example.com
RewriteRule ^(.)$ https://example.com/$1 [R=301,L]
サーバーはエックスサーバーです。
回答2件
あなたの回答
tips
プレビュー