回答編集履歴

2

追記

2020/11/12 12:35

投稿

otn
otn

スコア84645

test CHANGED
@@ -9,3 +9,29 @@
9
9
  RewriteRule ^path/to/image1.jpg$ /image.php?gen=/path/to/image1.jpg [E]
10
10
 
11
11
  ```
12
+
13
+ #追記
14
+
15
+ もしかして、固定URLじゃなくて、「ファイルが存在しないURLすべて」ということですかね?
16
+
17
+ ```Apahe
18
+
19
+ RewriteEngine On
20
+
21
+ RewriteCond %{REQUEST_FILENAME} !-f
22
+
23
+ RewriteCond %{REQUEST_FILENAME} !-d
24
+
25
+ RewriteCond %{DOCUMENT_ROOT}/another/$1 -f
26
+
27
+ RewriteRule ^(.*)$ /another/$1 [E]
28
+
29
+ RewriteCond %{REQUEST_FILENAME} !-f
30
+
31
+ RewriteCond %{REQUEST_FILENAME} !-d
32
+
33
+ RewriteRule ^(.*)$ /image.php?gen=/$1 [E]
34
+
35
+ ```
36
+
37
+ ドキュメントルート以外に書く場合はパス名の調整が必要です。

1

訂正

2020/11/12 12:35

投稿

otn
otn

スコア84645

test CHANGED
@@ -4,8 +4,8 @@
4
4
 
5
5
  RewriteCond /another/path/to/image1.jpg -f
6
6
 
7
- RewriteRule ^path/to/image1.jpg /another/path/to/image1.jpg [E]
7
+ RewriteRule ^path/to/image1.jpg$ /another/path/to/image1.jpg [E]
8
8
 
9
- RewriteRule ^path/to/image1.jpg /image.php?gen=/path/to/image1.jpg [E]
9
+ RewriteRule ^path/to/image1.jpg$ /image.php?gen=/path/to/image1.jpg [E]
10
10
 
11
11
  ```