htaccess not rewriting

XML, Perl, Python, and other languages can be discussed here, even if it isn't PHP (We might forgive you).

Moderator: General Moderators

Post Reply
User avatar
TheMoose
Forum Contributor
Posts: 351
Joined: Tue May 23, 2006 10:42 am

htaccess not rewriting

Post by TheMoose »

I'm trying to create a clean URL thumbnailing script using htaccess. In my htaccess file, I have:

Code: Select all

RewriteEngine On
RewriteRule ^thumbnail/([0-9]*\.[a-zA-Z]*)$  thumbnail.php?f=$1
The filename itself will be a numeric filename, ie: 123456789.jpg. This is coming from a database, so the files are strict.

What I want it to do is when I call (in an img tag) something like "uploads/thumbnail/123456789.jpg", it is really just calling the script "uploads/thumbnail.php?f=123456789.jpg". Every time I test this htaccess, I get a page that all it says is "No input file specified."

See for yourself:
http://www.whitemoose.net/overwhelm/upl ... 456789.jpg

But if you try:
http://www.whitemoose.net/overwhelm/uploads/thumbnail

It prints out the word "hi". The thumbnail.php (which is not written yet, all it does now is print out the word "hi") is being accessed properly via the second link, but not the first. I'm putting this htaccess file inside the /uploads directory, and not the base. There is no other htaccess file in any directory on my server.

I have also tried:

Code: Select all

RewriteEngine On
RewriteRule ^overwhelm/uploads/thumbnail/([0-9]*\.[a-zA-Z]*)$  overwhelm/uploads/thumbnail.php?f=$1
in the base directory, and I get the same thing.

What am I doing wrong?
User avatar
RobertGonzalez
Site Administrator
Posts: 14293
Joined: Tue Sep 09, 2003 6:04 pm
Location: Fremont, CA, USA

Post by RobertGonzalez »

I don't know that URL rewriting works within that scope. I could be wrong, but I have not known it to be used in a way that allows image paths to be rewritten, only page requests.
User avatar
TheMoose
Forum Contributor
Posts: 351
Joined: Tue May 23, 2006 10:42 am

Post by TheMoose »

Everah wrote:I don't know that URL rewriting works within that scope. I could be wrong, but I have not known it to be used in a way that allows image paths to be rewritten, only page requests.
I don't see why it wouldn't, as it's the basis for protecting image hotlinks from other sites.

My htaccess file is apparently pretty messed up because if you go to http://www.whitemoose.net/overwhelm/uploads/thumbnail/t, it shows something completely different, even though there is not even a directory called /thumbnail on my server!

EDIT: GAH! It works now, because of my saying "there is not even a directory called /thumbnail on my server!", I tried seeing if adding the /thumbnail directory would fix it, and it does :? I appreciate the response though, it got me to think of this again :)
Post Reply