Forum Moderators: phranque
I am trying this rule:
RewriteRule ^/explos/([0-9]+)/1/images/photo([0-9])([0-9])\.jpg http://www.example.com/explos/$1/images/$2/photo$3.jpg
My goal is to redirect from here:
http://www.example.com/explos/XX/1/images/photoYY.jpg
(XX= 1 or 2 digits, YY = 2 digits)
to here:
http://www.example.com/explos/XX/images/photoYY.jpg
Can somebody tell me what is wrong this this rule?
(example if you try http://www.example.com/explos/11/1/images/photo01.jpg you get a not found error, althrough http://www.example.com/explos/11/images/photo01.jpg exists...)
Thanks!
Slyv
[edited by: slyv at 4:05 pm (utc) on Oct. 25, 2007]
Now...on to your question...
Your rewrite rule shows
http://www.example.com/explos/$1/images/$2/photo$3.jpg
but you are wanting to redirect to
http://www.example.com/explos/XX/images/photoYY.jpg
Look at your $2 backreference...looks like the rewrite rule should be
http://www.example.com/explos/$1/images/photo$2$3.jpg
However, it would be better to simply lump the 2nd and 3rd backreferences together instead of doing them separately.
By the way...Welcome to WebmasterWorld!
[edited by: Philosopher at 3:29 pm (utc) on Oct. 25, 2007]
I removed the obvious error reported by Philosopher, but still I get a 404.
My rule is now:
RewriteRule ^/explos/([0-9]+)/1/images/photo([0-9]+)\.jpg http://www.example.com/explos/$1/images/photo$2.jpg
I also tried: RewriteRule ^/explos/(.+)/1/images/photo(.+)\.jpg [forbidden-places.net...]
because my single digit numbers start with a 0 (01, 02, 03...)
404 too!
Thanks for your help!
Greetings, Slyv
RewriteRule ^explos/([0-9]+)/1/images/photo([0-9]+)\.jpg explos/$1/images/photo$2.jpg
I removed the initial slash. I'm also assuming you are wanting to do an internal rewrite not an external redirect which is why I also removed the "http://www.example.com/" from the target URL.
Unless I'm just missing something silly or your server is setup odd, that should work.