htaccess: Redirect all urls containing "x" to "specific_img.jpg"
November 28, 2010 2:11 PM   Subscribe

I am trying to replace all requests to a certain directory on my website with a certain image. Any request to http://mywebsite.com/specific_directory/*.* would be replaced with http://mywebsite.com/specific_img.jpg.

Ok, so I have my website:

http://mywebsite.com/

I want all requests for URLs in the following directory:

http://mywebsite.com/specific_directory/

to be replaced with http://mywebsite.com/specific_img.jpg

So if you tried loading
http://mywebsite.com/specific_directory/image.jpg
http://mywebsite.com/specific_directory/file_that_doesnt _exist.png

you would receive http://mywebsite.com/specific_img.jpg every time.

I would also like to preserve the requested file name if possible. They see http://mywebsite.com/specific_directory/image.jpg in their address bar but are served up http://mywebsite.com/specific_img.jpg.

Can anybody give me a hint on this? Is .htaccess the right way to go with this? I would like this to work for hotlinking and for anybody that tried accessing it from my website. I would also like this to work for files that do not exist in the directory. Is all this possible?
posted by B(oYo)BIES (6 comments total)

This post was deleted for the following reason: I think you meant to post this over at Ask. -- pb



 
You want AskMe, it's right next door.
posted by Navelgazer at 2:12 PM on November 28, 2010


Whoops! Green's thataway --->
posted by Abiezer at 2:12 PM on November 28, 2010


Not another I/P thread...mods?
posted by iamck at 2:14 PM on November 28, 2010 [2 favorites]


You'll need an .htaccess file that redirects to AskMe for that.
posted by localhuman at 2:14 PM on November 28, 2010


I understand the confusion. They all look the same, when the only color you see is professional white.
posted by filthy light thief at 2:14 PM on November 28, 2010


hi.
posted by clavdivs at 2:14 PM on November 28, 2010 [1 favorite]


« Older The Flat Venus Society in Library Assessment;...   |   Bingo In The Blood Newer »


This thread has been archived and is closed to new comments