Welcome Guest, Not a member yet? Register   Sign In
Redirect image.gif to controller/function/image
#1

[eluser]DrDave[/eluser]
Hello,

I am working on dynamically generated images. I'm trying to have the url http://domain.com/rankimg/123.gif redirected to http://domain.com/index.php/rank/image/123 so that whatever the image is called, the name will be passed as a variable to the image function of the rank controller.

This is my .htaccess:

Code:
RewriteEngine On
RewriteRule ^rankimg\/([0-9]+)\.gif$ /index.php/rank/image/$ [L]

Using this, I get a 404 error, however going to http://domain.com/index.php/rank/image/123 produces the image. Any ideas what I am doing wrong?

Thanks in advance!
#2

[eluser]DrDave[/eluser]
I figured out how to do it using URI routing. I added this line to config/routes.php

Code:
$route['rankimg/(:num).gif'] = "rank/image/$1";




Theme © iAndrew 2016 - Forum software by © MyBB