Webmasters Stack Exchange is a question and answer site for pro webmasters. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have upgraded my gallery2 to gallery3, and notice that some links no longer resolve correctly. Since the proper way is to redirect these with a 301, that is the way I'm going. The following series need redirecting:

old: photo.meulie.net/v/various/Gry/
new: http://photo.meulie.net/various/Gry/

old: photo.meulie.net/v/Jacob/02112008310.jpg.html
new: http://photo.meulie.net/Jacob/02112008310

(both are of course just examples. there are 100's of folders & files to redirect...)

I think there were/are also direct links to images, but those I'm not bothering with for now.

Who can help me out? :-)

Regards, Evert

NB. these are the existing rewrite rules:

Options +FollowSymLinks
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^(.*)$ index.php?kohana_uri=$1 [QSA,PT,L]
RewriteRule ^$ index.php?kohana_uri=$1 [QSA,PT,L]
RewriteRule ^index.php/(.*) $1 [QSA,R,L]

Where should I insert your lines?

Greetings, Evert

share|improve this question

migrated from serverfault.com Feb 21 '11 at 21:38

This question came from our site for system and network administrators.

up vote 0 down vote accepted

try these... I've made some examples like you mention and these worked. Let me know if you got some corner cases that these rules don't cover.

RewriteEngine On

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^v/(.*[^/])/(.*[^/])/ /$1/$2/ [R=301]

RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule ^v/(.*[^/])/(.*[^/.])\.(.*).html$ /$1/$2? [R=301]
share|improve this answer
Hmm, it's not working, but that's probably because of the existing rewrite-rules... I should have mentioned those, of course... – Evert Feb 23 '11 at 13:03
Fixed it by changing [R=301] into [R=301,L] – Evert Feb 23 '11 at 13:40

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.