Right, I have been rather blindly fumbling around with htaccess and apache rewriterules to try and make certain things happen depending on what is in the current URL.
In plain talk, what I want is this:
IF URL contains 'jpg' or 'png' or 'gif', upper and lowercase, then make the url do one thing
IF URL does NOT contain 'jpg' or 'png' or 'gif', upper and lowercase, then make the url do another thing.
E.g.s
no image extension:
www.mysite.com/gallery/album1 => www.mysite.com/gallery/index.php?w=album1
image extension:
www.mysite.com/gallery/album1/photo.jpg => www.mysite.com/gallery/preview.php?w=album1&p=photo.jpg
so if it has an image extension, capture everything before the last '/' as w= and everything after thelast '/' (i.e. the photo name) as p=
I had success when it was not an image, i.e. just album level, but adding in the photo rule starts getting confusing.
My latest attempt is this:
Options +FollowSymlinks
RewriteEngine On
RewriteCond %{HTTP_URL} (\.(JPG|jpg|png|gif)$)
RewriteRule ^(.+)/(.+)$ preview\.php?w=$1&p=$2 [L]
RewriteCond %{REQUEST_URI} !^(jpg|png|gif)$
RewriteRule ^(.+)/$ index.php?w=$1 [L
Hope someone can help.
Thanks!