Welcome Guest, Not a member yet? Register   Sign In
Yet another routing or .htaccess question...
#1

[eluser]mrh[/eluser]
Hi, I'll try to make this short... I searched and I've been experimenting and I've read the user guide but I'm kind of not getting how to do this.

We have our company side in Code Igniter at our domain:

www.ourdomain.com

With our default route this takes us into the main controller and all is well.

My boss is a very active forum participant and he has a folder on the site full of images that he uses for emoticons, examples, etc. Because he is a lousy typist and he comes from a Windows base host (now on linux) he has not been watching the case of his references to these images. So in some of his posts he does:

http://www.ourdomain.com/ttt/SlapsHead.jpg

In another post he'll do:

http://www.ourdomain.com/ttt/SLAPSHEAD.JPG

Now on a Windows host this was fine. But on our new linux host it doesn't work of course. What I'm hoping to do is to use CodeIgniter to fix this problem for him. Since all of his images reside in a folder called "ttt" I was thinking about writing a controller called "ttt" and the code within that controller would have an array of the files in the directory and be able to fix the case. So the goal would be if one of his posts is:

http://www.ourdomain.com/ttt/SLAPSHEAD.JPG

but the file in the folder is really "slapshead.jpg" that I could in effect intercept this call and return the correct file from say an echo statement.

My issue is getting the routing to the controller to work. In my limited Code Igniter experience to get to the ttt controller I need to call:

http://www.ourdomain.com/index.php/ttt

I need a route or an .htaccess entry that will take his calls like:

http://www.ourdomain.com/ttt/SlapsHead.jpg

and map them to my controller of choice like:

http://www.ourdomain.com/index.php/ttt/SlapsHead.jpg

In my controller I'd look at the argument which would be "SlapsHead.jpg", scan the array and figure out that the disk filename is: "slapshead.jpg" and I'd basically echo out that image file.

It seems like this should be doable but in my few attempts to achieve the correct routing I cannot get it to work. I was planning to rename his image directory to something like _ttt and then when his request came in for

http://www.ourdomain.com/ttt/SlapsHead.jpg

my controller would load and hopefully cache the list of files in the _ttt folder and use that as a look up table to return the correct thing. I was sort of thinking of trying to redirect to the correct image file.

Any thoughts? If I can get this to work then we can stay on our linux host. Other wise he will take us back to the wonderful world of Windows which will make my job more difficult I think to support the site.

Any help would be much appreciated.



Messages In This Thread
Yet another routing or .htaccess question... - by El Forum - 09-24-2012, 04:31 PM
Yet another routing or .htaccess question... - by El Forum - 09-25-2012, 09:45 AM



Theme © iAndrew 2016 - Forum software by © MyBB