Page 1 of 1

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

Posted: Sat May 17, 2008 12:13 am
by manjifera
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="http://www.nbfun.net/image" target="_blank"><img src="http://nbfun.net/image.gif?uid=11219363 ... +TEXT+HERE" alt="www.nbfun.net"></a>

Image

Re: How to use .jpg?text=123 insted of .php?text=123

Posted: Sat May 17, 2008 12:45 am
by Kieran Huggins
You have two options:

add jpg as a PHP script extension for that folder

Code: Select all

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 [b]image.123.jpg[/b] into [b]image.php?text=123[/b]. 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.

Re: How to use .jpg?text=123 insted of .php?text=123

Posted: Sun May 18, 2008 5:16 am
by manjifera
hello thanks for great help :-) its works ..
Its now looks like this : :D :D :D

Reg
Prashant