redirect folder contents

New to mod_rewrite? This is a good place to start.

redirect folder contents

Postby jon23d » Tue Sep 14, 2010 8:51 am

Hello again,

I'm trying this again, but after months away from htaccess, I'm having issues...

I currently use this:
Code: Select all
Options +FollowSymLinks -MultiViews -Indexes
RewriteEngine On

# disable magic quotes
php_flag magic_quotes_gpc Off

# disable register globals
php_flag register_globals 0

# redirect everything to the dispatcher, everything!
RewriteRule ^(.*)$ dispatcher.php [QSA,L,NC]


Everything is routed to dispatcher.php, where various things happen.

There are images residing in resources/images and webroot/images. Each folder has subfolders with images in them as well. The router currently checks for the files and passes them through to the browser. Other files in the webroot and resources folder (css, js, etc.) are parsed and must go through the dispatcher.

The url for a file named 1.jpg in resources/images would be http://domain.com/1.jpg. The url for a file named 1.jpg in webroot/images would also be http://domain.com/1.jpg. If the file exists in both folders, then the one in resources is served. Any number of arbitrary subfolders can exist in either folder.

Publicly accessible Images that are uploaded to the system through the backend are stored in resources/images/SOMETHING/filename.jpeg###x###. The numbers represent the maximum height and width of the image. Each image is resized multiple times, and would have multiple names with different numbers. If ### is invalid or out of range, then the application takes the largest image and sends that through. These images have urls of http::/domain.com/images/SOMETHING/filename.jpeg?w=###&h=###

I am trying to do two things:

1) Stop parsing files in webroot/images and resources/images and let apache send them through (but NOT any other files in resources/ or webroot/)
2) Pass images from resources/images/SOMETHING through apache as well, but first converting the w & h querystrings into the filename
3) If the size specified in step 2 (w & h) does not exist (resources/images/SOMETHING/filename.jpeg###x####), but filename.jpeg is correct,
then pass through to the dispatcher and let it give out the largest size, otherwise return a 404.

I don't know why this seems so difficult, but nothing seems to be working...
jon23d
 
Posts: 19
Joined: Sun Feb 01, 2009 11:36 pm

Return to Beginner's Corner

Who is online

Users browsing this forum: Yahoo [Bot] and 2 guests

cron