Jump to content

Mod_Rewrite Help Needed


godius

Recommended Posts

Hi guys, im trying to make a .htaccess file with mod_rewrite.

 

My goal is to forward all 4 character filenames that are .jpg, to /pic.php?i=filenamehere.

 

RewriteEngine On

RewriteRule ^(.*)\.jpg$ /pic.php?i=$1

 

That works, but it forwards ALL jpgs on my server, but it should only fake the links that are straight on my domain root.

 

http://domain.com/ABCD.jpg - this should be linked to http://domain.com/pic.php?i=ABCD.jpg

ABCD.jpg = in the root directory, and is 4 characters.

 

All other .jpgs should be ignored by this rewrite.

 

Can anyone please help me get the right rewriterule?

 

Thanks so much!

 

Link to comment
https://forums.phpfreaks.com/topic/175638-mod_rewrite-help-needed/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.