Please help me - how to make an url like this

Discussion in 'PHP' started by puya4ever, Sep 1, 2010.

  1. #1
    Hi to everyone . I starting to build in PHP a new web site with articles, news and others.
    I have a problem with URL of category .

    For example I have a scheme like: site.com/?a=downloads&cat=27

    How can I make a pretty structure like: site.com/downloads/category/sub-category/sub-sub-category/ for this .

    cat=27 = 27 is the ID of the latest subcategory in a tree . I have in database something like:

    ID name parent


    Please, help me, give a suggest, how can I do that, can you write for me a rule in htaccess ? I need to understand a concept about how to do that.

    I hope you will help me,
    Thanks.
     
    puya4ever, Sep 1, 2010 IP
  2. HungryMindz

    HungryMindz Member

    Messages:
    7
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    38
    #2
    Hi!

    Use .htaccess For URL's

    .htaccess Code:

    RewriteEngine on
    RewriteRule ^/?a=downloads&cat=27 /downloads/category/sub-category/sub-sub-category/ [L]

    More About .htaccess: http://www.htaccesstools.com/
     
    HungryMindz, Sep 1, 2010 IP
  3. puya4ever

    puya4ever Peon

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Thanks for answer but, the subcategories are dinamicaly . I can have a structure like:
    site.com/downloads/category or site.com/downloads/category/sub-category/ ...or just simple site.com/downloads
     
    puya4ever, Sep 2, 2010 IP