Matt Wilcox アダプティブ イメージを CakePHP で動作させようとしていますが、うまくいきません。 http://adaptive-images.com/
CakePHP には、独自の .htaccess ファイルが 3 つ付属しています。で/
、 で 1 つ 、/app/
で 1 つ/app/webroot/
これらの 4 つのファイルを連携させて、ルートに配置したファイル adapt-images.php にイメージ要求が送信されるようにする必要があります。
これは、adaptive-images の htaccess です。
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine On
# Adaptive-Images -----------------------------------------------------------------------------------
# Add any directories you wish to omit from the Adaptive-Images process on a new line, as follows:
# RewriteCond %{REQUEST_URI} !some-directory
# RewriteCond %{REQUEST_URI} !another-directory
RewriteCond %{REQUEST_URI} !assets
# Send any GIF, JPG, or PNG request that IS NOT stored inside one of the above directories
# to adaptive-images.php so we can select appropriately sized versions
RewriteRule \.(?:jpe?g|gif|png)$ adaptive-images.php
# END Adaptive-Images -------------------------------------------------------------------------------
</IfModule>
これは root / からの cakes htaccess です
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>
これは /app/ からの cakes htaccess です
<IfModule mod_rewrite.c>
RewriteEngine on
RewriteRule ^$ webroot/ [L]
RewriteRule (.*) webroot/$1 [L]
</IfModule>
これは /app/webroot からの cakes htaccess です
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^(.*)$ index.php [QSA,L]
</IfModule>
アダプティブ イメージのルールはファイルの 1 つで最初に来る必要があり、最後のルールなどに [L] を追加する可能性があると思います。しかし、これまでに達成できた唯一のことは、画像へのパスを壊して、/img/myimage.gif
代わりに Cake が ImgController を探し始めるようにすることです。
Apache のログには何の価値もありません。
助言がありますか?
編集:現在、このように見えます
私の変更/
- htaccess は以下のようになりました。Cake から ImgController が見つからないというエラーが表示され、アダプティブ イメージが配置する ai-cache-folder にイメージが作成されません。
<IfModule mod_rewrite.c>
Options +FollowSymlinks
RewriteEngine on
RewriteCond %{REQUEST_URI} !assets
RewriteRule \.(?:jpe?g|gif|png)$ adaptive-images.php
RewriteCond %{REQUEST_URI} !adaptive-images\.php [NC]
RewriteRule ^$ app/webroot/ [L]
RewriteRule (.*) app/webroot/$1 [L]
</IfModule>