Resolving Images after URL Changes - .htaccess -


i have done few changes , unable images resolved correctly.

old = http://www.domain.com/dir/images/*.jpg

new = http://www.domain.com/old_dir/images/*.jpg

i using following rewriterule,

rewriterule ^dir/images/(.*)\.jpg$ old_dir/images/$1\.jpg [r=301] 

doesn't work, pointers on how work images resolved correctly ?

thanks

i suspect

rewriterule ^dir/images/(.*)\.jpg$ old_dir/images/$1\.jpg [r=301] 

should be

rewriterule ^/dir/images/(.*)\.jpg$ /old_dir/images/$1\.jpg [r=301] 

the ^ signifies anchor @ beginning, , anchor followed dir excludes required leading /

see apache docs details.

debugging steps

as far specific steps debugging try:

  1. rewriterule ^.*$ /test.html [r=301] make sure rewriting engine working.
  2. if works, can try absolute uri instead of regex one: rewriterule ^/dir/images/image1.jpg$ /old_dir/images/image1.jpg [r=301]
  3. if works, can try tweaking regular expressions make sure you're getting them right.

are there indications re-writing happening @ all? url in browser being rewritten @ all?


Comments

Popular posts from this blog

javascript - Enclosure Memory Copies -

php - Replacing tags in braces, even nested tags, with regex -