SitePoint Sponsor

User Tag List

Results 1 to 7 of 7
  1. #1
    SitePoint Addict ruba's Avatar
    Join Date
    Apr 2005
    Location
    Amman -Jordan
    Posts
    339
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    dynamic mod rewrite

    Hi every body
    is there anyway to create dynamic mod rewrite?

    for example
    http://www.example.com/index.php?page=cateogry&id=334
    this page title is "Sitepoint"

    I wana make it
    http://www.example.com/cateogry/334/sitepoint.html

    is there any way to do same like this ??
    Open Blocked website
    Open Blocked Website
    Knowledge Is Knowing That A Tomato Is A Fruit,
    Wisdom Is Not Putting It In A Fruit Salad.

  2. #2
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    The only way I can think of is that every time you insert a page record, you write to the .htaccess file - but I'm not sure if you can do that.
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  3. #3
    SitePoint Zealot
    Join Date
    Oct 2007
    Location
    In the blogosphere
    Posts
    108
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Or, you could ignore the html file. and just take the first two
    bLueFrogX's Blog - Random Ramblings of a NEET Techie ★

  4. #4
    SitePoint Wizard stereofrog's Avatar
    Join Date
    Apr 2004
    Location
    germany
    Posts
    4,324
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    mod_rewrite uses regular expressions, so it's dynamic by its nature, for example
    Code:
    RewriteRule /([a-z]+)/([0-9]+)/([a-z]+).html  index.php?cat=$1&id=$2&site=$3

  5. #5
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I think they're on about grabbing the title of the page aswell.

    It would be quicker to add a parameter, title, to index.php.
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  6. #6
    Team SitePoint santouras's Avatar
    Join Date
    Jul 2006
    Location
    planet earth
    Posts
    276
    Mentioned
    13 Post(s)
    Tagged
    0 Thread(s)
    its probably easier to funnel everything through a single controller file and figure out your route from there rather then writing out to a htaccess file every time
    my utility belt tells me its to the bar batman

    read the manual then google it then do a search THEN post....

  7. #7
    SitePoint Addict ruba's Avatar
    Join Date
    Apr 2005
    Location
    Amman -Jordan
    Posts
    339
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks every body ,

    I find this class
    http://www.phpclasses.org/browse/package/1943.html

    this thing called clean url , u can make ur page with a dynamic name
    Open Blocked website
    Open Blocked Website
    Knowledge Is Knowing That A Tomato Is A Fruit,
    Wisdom Is Not Putting It In A Fruit Salad.


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
  •