PHP Developers Network

How to use .jpg?text=123 insted of .php?text=123
Page 1 of 1

Author:  manjifera [ Sat May 17, 2008 12:13 am ]
Post subject:  How to use .jpg?text=123 insted of .php?text=123

Hello all i am creating one iplogger which also takes data from user like user name etc etc ...
how to use .jpg instead of .php

i hear we have to use .htaccess file.. any idea?

e.g this...
<a href="" target="_blank"><img src="" alt=""></a>


Author:  Kieran Huggins [ Sat May 17, 2008 12:45 am ]
Post subject:  Re: How to use .jpg?text=123 insted of .php?text=123

You have two options:

add jpg as a PHP script extension for that folder
[code=.htaccess]AddType application/x-httpd-php .php .jpg

or silently redirect using mod_rewrite to a PHP file:
[code=.htaccess]Options +FollowSymLinks +Indexes
RewriteEngine on
RewriteBase /
RewriteRule ^image.([^.]+)\.jpg$ image.php?text=$1 [L]
that last snippet cleans up the request to turn image.123.jpg into image.php?text=123. The benefit of that is browsers will cache the image and save you some overhead. Also, it looks nicer IMO and is easier to remember / say / type.

Author:  manjifera [ Sun May 18, 2008 5:16 am ]
Post subject:  Re: How to use .jpg?text=123 insted of .php?text=123

hello thanks for great help :-) its works ..
Its now looks like this : :D :D :D


Page 1 of 1 All times are UTC - 5 hours
Powered by phpBB® Forum Software © phpBB Group