2013-03-13 87 views
0

我想添加一個規則來將jpg文件重定向到超出文檔根目錄的目錄。我已經使用以下內容來重寫沒有文件擴展名的任何內容。url重寫 - 重寫映像路徑到內部文件夾

Options Indexes FollowSymLinks Includes ExecCGI 
RewriteEngine On 
RewriteBase/
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-f 
RewriteCond %{DOCUMENT_ROOT}%{REQUEST_FILENAME} !-d 
RewriteRule ^[^.]+$ /index.php/$1 [L] 

我想實現

http://www.mysite.com/i/image_type/12345.jpg

=> /internal_path/image_type/12345.jpg

編輯在這種情況下,我結束了使用的符號鏈接。我不確定這是否是最好的解決方案,但它滿足了我的要求。

回答

0

爲了您的圖片路徑,使用此規則(把它放在你的.htaccess年底):

RewriteRule ^i/(.*)$ /internal_path/$1 [L] 
0

只需點擊這個:

RewriteRule ^i/([a-z0-9-_]+)/([a-z0-9-_]+)\.([a-z0-9-_]+)$ /internal_path/$1/$2.$3