thesavior
10-05-2007, 05:27 PM
Okay, so I currently have a php script set up to do something with an image. I call the script by saying:
http://eli-white.com/lastfm/index.png?user=thesavior01
I want to call it by saying:
http://eli-white.com/lastfm/thesavior01.png
How do i get about doing this?
nikkiH
10-05-2007, 06:50 PM
If enabled, mod_rewrite
Something like
RewriteEngine on
RewriteRule ^http://eli-white.com/lastfm/index.png?user=(.*)$ http://eli-white.com/lastfm/$1\.png
thesavior
10-05-2007, 07:06 PM
shouldnt it be the other way around? what it is => what it translates to?
so if .htaccess is in the same folder as index.png it would be:
RewriteEngine on
RewriteRule ^(.*)\.png index.png?user=$1
nikkiH
10-05-2007, 07:37 PM
Probably. Give it a shot :)
thesavior
10-05-2007, 08:23 PM
Meh, its not working properly, somehow my script is getting "index" from the user variable. im pretty confident its not my script that is the problem.
nikkiH
10-05-2007, 09:10 PM
Where's the dollar sign that indicates end line, slashes for directories...?
I'm not used to seeing these without that.
Did you intend to leave them out?
nikkiH
10-05-2007, 09:20 PM
Let me make sure I have this correctly.
You want to re-write this url:
http://eli-white.com/lastfm/thesavior01.png
To this:
http://eli-white.com/lastfm/index.png?user=thesavior01
And this didn't work:
RewriteEngine on
RewriteRule ^/lastfm/(.*)\.png$ /lastfm/index.png?user=$1 [R]
And this didn't work:
RewriteEngine on
RewriteRule ^/lastfm/(.*)\.png$ /lastfm/index.png?user=$1 [QSA,R]
thesavior
10-05-2007, 10:07 PM
all of your statements are correct.
and none of that worked.
I know for a fact that mod_rewrite is on.