回答編集履歴
1
回答内容を詳しくした
test
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
現状、```301```を返しているのを```404```
|
1
|
+
現状、リダイレクト先を指定し```301```を返しているのを、以下のようにリダイレクト先を指定せず```R=404```とすることで実現できます。
|
2
2
|
|
3
3
|
|
4
4
|
|
@@ -7,3 +7,15 @@
|
|
7
7
|
RewriteRule ^(.*)index.php$ - [R=404,L]
|
8
8
|
|
9
9
|
```
|
10
|
+
|
11
|
+
|
12
|
+
|
13
|
+
補足
|
14
|
+
|
15
|
+
```RewriteRule```のSyntaxは```RewriteRule Pattern Substitution [flags]```で、```[flags]```に```R[=code]```と指定するとリダイレクト(```code```はhttp Status Code)となります。
|
16
|
+
|
17
|
+
が、```Substitution```で指定するリダイレクト先に```-```を指定することにより、どこにもリダイレクトされません。この時、```R[=code]```の```code```に404を指定することで、単に```404 Not Found```をHTTPステータスコードとして返すことができます。
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
[https://httpd.apache.org/docs/2.4/en/mod/mod_rewrite.html#rewriterule](https://httpd.apache.org/docs/2.4/en/mod/mod_rewrite.html#rewriterule)
|