私はずっと探していましたが、自分に合った解決策が見つかりません。
http://example.com/files/file.ext -> http://example.com/users/documents/file.extにリダイレクトしようとしています
ファイルに直接アクセスしたときに何を試しても、ダウンロードされます。ファイルの GET リクエストは、私の apache ログにも表示されません。デバッグにログオンしています。
[編集] ダウンロードしようとしているファイルは、ppt、pdf、xls、zip、doc など、さまざまな種類のものです。ファイル名を新しい URI の末尾に書き換えたいと考えています。CodeIgniter も使用しているため、/users/documents/ は RESTy uri です。
誰でも修正がありますか?
ここに私の .htaccess ファイルがあります:
<IfModule mod_rewrite.c>
RewriteEngine On
Options +FollowSymLinks
RewriteBase /
#Removes access to the system folder by users.
#Additionally this will allow you to create a System.php controller,
#previously this would not have been possible.
#'system' can be replaced if you have renamed your system folder.
RewriteCond %{REQUEST_URI} ^system.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#When your application folder isn't in the system folder
#This snippet prevents user access to the application folder
#Submitted by: Fabdrol
#Rename 'application' to your applications folder name.
RewriteCond %{REQUEST_URI} ^application.*
RewriteRule ^(.*)$ /index.php?/$1 [L]
#Checks to see if the user is attempting to access a valid file,
#such as an image or css document, if this isn't true it sends the
#request to index.php
<IfModule mod_php5.c>
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?/$1 [N]
RewriteCond %{REQUEST_URI} ^/files/ [NC]
RewriteRule ^/files/(.*)$ /users/documents/$1 [L,R=301]
</IfModule>
<IfModule !mod_php5.c>
RewriteRule ^(.*)$ index.php?/$1 [L]
</IfModule>
</IfModule>