Results 1 to 1 of 1

Thread: rewriting uri to .png?

  1. #1
    Join Date
    Feb 2007
    Location
    Colorado, USA
    Posts
    3,716
    Mentioned
    51 Post(s)
    Quoted
    624 Post(s)

    Default rewriting uri to .png?

    nginx / php

    I want to have someone request example.com/folder/picture.png

    that routes to picture.php which is creating an image

    PHP Code:
    <?php
    $images 
    = ['http://i.imgur.com/ykwcC.jpg','http://i.imgur.com/Urrl4.jpg'];
    $i rand(0,1);
    header('Content-Type: image/jpeg');
    readfile($images[$i]);
    ?>
    ^ for testing

    I've tried like 50+ location scripts on stackoverflow etc for nginx, none working.. can't get anything working =/


    of course the most familiar example to you guys would be http://www.draynor.net/signatures



    nvm got it

    literally opposite of what people were posting.......

    Code:
            location ~ ^/folder/img\.png$ {
                    rewrite ^/folder/img\.png$ /folder/img.php last;
            }
    Last edited by grats; 04-06-2015 at 03:48 AM.
    The only true authority stems from knowledge, not from position.

    You can contact me via matrix protocol: @grats:grats.win or you can email me at the same domain, any user/email address.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •