Jump to content

Recommended Posts

Ok, i am trying to make mod_rewrite forward requests for images to a php page with the image as a variable.

 

e.g. osij9wu09iqwioj0e.jpg fowards to index.php?image=osij9wu09iqwioj0e.jpg

 

i currently have:

Options +FollowSymLinks 
RewriteEngine on 
RewriteRule ^([a-z/0-9/.]+)$ index.php?image=$1 [L]

 

but then because there are not many arguments it forwards to index.php but then to index.php again and gets stuck in a loop...

 

what do i have to change to the rule so that it doesnt work if the page requested is index.php?

 

thanks!

Link to comment
https://forums.phpfreaks.com/topic/83182-solved-simple-rule-help/
Share on other sites

thats for that one!

 

it almost works but can be changed in 2 ways.

a) not all my images are jpg, some gif/png etc

b) with that, the extension of the image isnt copied to the variable. but yes, if they were all jpgs that would be easy to solve but theyr not  :(

 

thanks for your help!

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.