SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict The Mog's Avatar
    Join Date
    Dec 2002
    Location
    Manchester UK
    Posts
    310
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    mod rewrite help

    Hi all,

    i think that this can only be achieved using mod rewrite which i have Zero idea on how to do.....

    i have a counter script called image.php which generates a dynamic image

    you reference the script like so.....

    <image src=http://www.server.com/image.php?uid=1234>

    is there a way i can reference it like so .....

    <img src=http://www.server.com/1234.bmp>

    I hope you understand what i mean

    Thanks

    K-

    PS: when caling the script i get the users IP so i dont have duplicate counts, will this still be possible?

  2. #2
    Certified Ethical Hacker silver trophybronze trophy dklynn's Avatar
    Join Date
    Feb 2002
    Location
    Auckland
    Posts
    14,645
    Mentioned
    19 Post(s)
    Tagged
    3 Thread(s)
    moggie,
    Code:
    RewriteRule ^/?([0-9]+)\.(jpe?g|gif|bmp)$ image.php?uid=$1 [L]
    Since this regex is only looking for the digital name of an image file (jpeg, jpg, gif or bmp), it's a simple matter to redirect it (and all REAL image files that are named only with digits) to your image.php script as a query string. Since there was neither an absolute URL redirection or Permanent redirection, the REAL URL will remain hidden, too!

    Have a look at my signature article for more information.

    Regards,

    DK
    David K. Lynn - Data Koncepts is a long-time WebHostingBuzz (US/UK)
    Client and (unpaid) WHB Ambassador
    mod_rewrite Tutorial Article (setup, config, test & write
    mod_rewrite regex w/sample code) and Code Generator


Bookmarks

Posting Permissions

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