0
votes

I want to add a rule to redirect jpg files to a directory beyond the document root. I already use the following which rewrites anything without a file extension.

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]

I want to achieve

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

=> /internal_path/image_type/12345.jpg

EDIT In this case I ended up using a symbolic link. I am not sure if it was the best solution but it served my requirements.

2

2 Answers

0
votes

For your image path, use this rule (put it at the end of your .htaccess) :

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

Simply check this:

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