Forum Moderators: phranque

Message Too Old, No Replies

need help with rewriting and images

         

PokeTech

6:44 pm on Aug 9, 2008 (gmt 0)

10+ Year Member



Well I have a page called sig1.php?rsn={$name} that creates an image based on whatever $name is. Lets say I have this image:

http://example.com/sig1.php?rsn=Poketech

and thats supposed to be an image (that what above is just an example) well sometimes when I go to forums and try and put it into my signature it gives me this error:

Sorry, dynamic pages in the [IMG] tags are not allowed

Is there anyway to like by pass that to get it to show the image? Or is there a different way?

Nutter

7:59 pm on Aug 9, 2008 (gmt 0)

10+ Year Member



mod_rewrite it to a non-dynamic looking url?

PokeTech

10:42 pm on Aug 9, 2008 (gmt 0)

10+ Year Member



Well I've been looking at it for a while now and I'm still not understanding that much first I put this in the .htaccess file:

RewriteEngine on

but then how do I get it to change sig1.php?rsn=PokeTech to:

/sig1/PokeTech.png

How do I do that?

Nutter

11:08 pm on Aug 9, 2008 (gmt 0)

10+ Year Member



Try this to start. It should be close.

RewriteRule ^sig1/(.*)\.png$ sig1.php?rsn=$1 [R=301,L]

StoutFiles

11:49 pm on Aug 9, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Options +FollowSymLinks
RewriteEngine on
RewriteRule ^sig1/([^/]+) /sig1.php?rsn=$1 [NC]

while you're at it...

Make sure the www. is always there:

RewriteCond %{HTTP_HOST} ^example.com
RewriteRule (.*) http://www.example.com/$1 [R=301,L]

Remove .php from all your pages:

RewriteRule ^(.*)\/$ $1.php [NC]

PokeTech

1:49 am on Aug 10, 2008 (gmt 0)

10+ Year Member



neither of those seem to work or I'm just doing something wrong... I pasted those in my .htaccess (not both at once) and I did it with the .php extension and without it.

StoutFiles gave me an server error thing, and then other than that I got a message saying it couldn't find the file/image.

StoutFiles

2:06 am on Aug 10, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Part 2 should go first, then part 1, then part 3. I have it on multiple sites so it should be fine.

For the image link I omitted the .png at the end, that is not needed.

http://www.example.com/sig1/PokeTech

PokeTech

11:38 am on Aug 10, 2008 (gmt 0)

10+ Year Member



This is what my .htaccess file has in it:

options +followsymlinks
RewriteEngine on
RewriteRule ^sig1/([^/]+) /sig1.php?rsn=$1 [NC]
RewriteRule ^(.*)\/$ $1.php [NC]

and then I have a file named sig1.php but for some reason when I go to that url http://www.example.com/sig1/PokeTech it gives me an internal server error.

Nutter

6:24 pm on Aug 10, 2008 (gmt 0)

10+ Year Member



What do your error logs say?

PokeTech

2:31 pm on Aug 18, 2008 (gmt 0)

10+ Year Member



Its still not working right.

Lets say I have this url: http://example.com/site/signatures.php?id=1
how do I turn it into: http://example.com/site/signatures/1.png

Can someone give me the code to that? And does it have to be placed in a file called .htaccess or httpd.conf?

g1smd

7:50 pm on Aug 18, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Wrong way round.

You need to take this URL: http://example.com/site/signatures/1.png
and translate the request so that this internal filepath responds: /site/signatures.php?id=1

That's one URL and one internal filepath.

jdMorgan

9:38 pm on Aug 18, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



And the error log info requested above is important if you want to get this working...

Jim