Urgent Help Needed about URL REWRITE

Discussion in 'PHP' started by sickoo, Mar 17, 2008.

  1. #1
    There is a problem on pagination.
    When i rewrite pages like this;
    http://www.domain.com/category/item/pagenumber/
    It works but it doesn't work on the first page that has no page number. Because to "slashes" comes together like this;
    http://www.domain.com/category/item//

    What should i do to avoid this?
    Thank You all.
     
    sickoo, Mar 17, 2008 IP
  2. sickoo

    sickoo Guest

    Messages:
    27
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    No one to help?
     
    sickoo, Mar 17, 2008 IP
  3. Gordaen

    Gordaen Peon

    Messages:
    277
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    0
    #3
    You're going to have to give more information if you want help. How are you rewriting the URIs? Apache? Nginx? PHP? Without seeing any of your code, I could guess a thousand ways that you are doing pagination and guess another thousand things for each of those ways that might be where your problem lies.
     
    Gordaen, Mar 17, 2008 IP
  4. kmap

    kmap Well-Known Member

    Messages:
    2,215
    Likes Received:
    29
    Best Answers:
    2
    Trophy Points:
    135
    #4
    hi

    give the first page a page number in your script

    If you want me to do it for you i can do nominal charges apply
    Regards

    Alex
     
    kmap, Mar 17, 2008 IP
  5. sickoo

    sickoo Guest

    Messages:
    27
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    I'm adding a &page=23 at the end of the url like;
    file.php?category=this&item=that&page=12

    the problem is, I wish to change page links like the one I wrote before, but I dont want page 1 to appear and I don't wish adjacent slashes too. Thanks in advance. I use PHP and Apache.
     
    sickoo, Mar 17, 2008 IP
  6. sickoo

    sickoo Guest

    Messages:
    27
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Any ideas my friends? It's very important at the moment.
     
    sickoo, Mar 17, 2008 IP
  7. Revolution333

    Revolution333 Peon

    Messages:
    227
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    0
    #7
    So your doing Mod_Rewrite? WIth PHP?
     
    Revolution333, Mar 17, 2008 IP
  8. AsHinE

    AsHinE Well-Known Member

    Messages:
    240
    Likes Received:
    8
    Best Answers:
    1
    Trophy Points:
    138
    #8
    If you don't want &page=1 to appear simply do not put it at the end of the url. And in the script you should place this line:
    
    if (!isset($_GET['page'])) $page = 1;.
      else $page = intval($_GET['page']);
    
    PHP:
    So in $page variable you will get the number of necessary page.
    But I guess the question is about writing a proper .htaccess file too.
     
    AsHinE, Mar 18, 2008 IP