SitePoint Sponsor

User Tag List

Results 1 to 3 of 3

Hybrid View

  1. #1
    SitePoint Enthusiast
    Join Date
    Nov 2008
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    htaccess masking question

    I'm developing a quote of the day website and using this in my index.php to redirect the user to a url specific to the current day:

    PHP Code:
    <?php header('Location: /'.date("z")); ?>
    That points the browser to a URL like this:

    http://domain.com/221 (where 221 is the day of the year)

    But I obviously don't want to create 365 different folders for all of these days... so how do I do it?

    Can I create a file like http://domain.com/quote.php?day=221 that masks to http://domain.com/221

    Help!... and THANKS for your help.
    -------------------------------------------
    Benjamin Kouba | 26 | DE, USA
    Portfolio: LEAF9 LLC (@leaf9)
    Recent Project: DIY Espresso Drinks (@diyespresso)

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Code:
    RewriteEngine On
    RewriteRule ^/?([0-9]+)$ quote.php?day=$1 [L]

  3. #3
    SitePoint Enthusiast
    Join Date
    Nov 2008
    Posts
    35
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks, Dan! That is absolutely spot on.
    -------------------------------------------
    Benjamin Kouba | 26 | DE, USA
    Portfolio: LEAF9 LLC (@leaf9)
    Recent Project: DIY Espresso Drinks (@diyespresso)


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
  •