で存在しないファイルの検索には、いくつかのテンプレートとその画像mod_rewriteを、別のフォルダ
/templates/template1/images/image1.jpg
/templates/template1/images/header/red/new/image1.jpg
/templates/template1/image2.jpg
/templates/template2/images/image2.jpg
/templates/template2/image2.jpg
のサンプルです今度は、テンプレートが画像やファイルを見逃すことがあります。そのような場合、残りのURLを保持しながら、ユーザーを「デフォルト」のテンプレートにリダイレクトしたい場合があります。画像が見つからない場合
だから与えられた例については、利用者がこの作品を作るのが私の試みである
/templates/default/images/image1.jpg
/templates/default/images/header/red/new/image1.jpg
/templates/default/image2.jpg
/templates/default/images/image2.jpg
/templates/default/image2.jpg
、それは
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_URI} !^/templates/default/(.*)$
RewriteRule ^/templates/(.*)/(.*) /templates/default/$2 [R]
仮想ホスト・ファイルに定義されていますにリダイレクトする必要があります
今すぐ
/template1/images/image1.jpg to /templates/default/image1.jpgをリダイレクトしてから500エラーをスローします。
私はここで間違っていますか?
その500エラーに関するApacheエラーログの詳細はありますか? – megaflop
'^/templates /(.*)/(.*)$'に '$ /'を追加すると、 – megaflop