![]() |
Apache Rewrite if image doesn't exist - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Using CodeIgniter (https://forum.codeigniter.com/forum-5.html) +--- Forum: General Help (https://forum.codeigniter.com/forum-24.html) +--- Thread: Apache Rewrite if image doesn't exist (/thread-67831.html) |
Apache Rewrite if image doesn't exist - RBX - 04-15-2017 I have a resize controller with method named index which performs the resizing. PHP Code: public function index($location = '', $size = '', $image = '') { I want to rewrite requests for images which don't exist to this function, but can't seem to get it to work. Code: <IfModule mod_rewrite.c> I really have no experience in writing such rules, any help would be appreciated. Edit: I was running it from folder CIAppScaffolding, so I needed to add RewriteBase /CIAppScaffolding/ Edit: It worked, but for some reason, seems to have stopped working. I'm confused. Edit: I think it didn't work, I must've hit the URL of a previously generated image. So back to the original question. RE: Apache Rewrite if image doesn't exist - RBX - 04-16-2017 I'm now using PHP Code: $route['^public/upload/([a-z]+)/(large|catalog|thumb|banner)/([^/]+\.(?:jpg|png|jpeg))$'] = 'resize/index/$1/$2/$3'; but this should be possible with just .htaccess rewrite rules, shouldn't it? |