SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Enthusiast Gerlof's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Modrewrite question

    page.php?name=' .$row->item_id . '

    How do i mod_rewrite this?

  2. #2
    SitePoint Enthusiast Gerlof's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Found it out, RewriteRule ^page/([^/]+)/?$ page.php?name=$1 [L]

    stupid me

  3. #3
    SitePoint Wizard TheRedDevil's Avatar
    Join Date
    Sep 2004
    Location
    Norway
    Posts
    1,198
    Mentioned
    4 Post(s)
    Tagged
    1 Thread(s)
    You might want to limit the rule, if your name only contain letters or numbers, then you only want the rule to work then.

  4. #4
    SitePoint Enthusiast Gerlof's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Hmm i don't get this:

    page.php?name=' .$row->item_id . '/' .$row->item_title . '

    i want to display it like page/id/nice-title/

    When i add item_title the page redirect don't work.
    But with only page/id it works..
    But i want to item_title on the end. But its more dummie so it looks nice.
    Because page/id/ only is little bit bored and not seo friendly.

    How can i do this?

  5. #5
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,807
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    you need to add another 'atom' to your mod_rewrite to cath the item_title.
    Post your mod_rewrite as it is now
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  6. #6
    SitePoint Enthusiast Gerlof's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I got this,

    page.php?name=' .$row->item_id . '/' .$row->item_title . '


    want to display page/id/fancy-title-here

    The items with atom parsing works fine.

    And the page/id/ redirect works fine to, i only want to add fancy-title-here from item_title. But if i add it the redirect is broken.

  7. #7
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,807
    Mentioned
    158 Post(s)
    Tagged
    3 Thread(s)
    then you would need something like
    Code:
    RewriteRule ^page/([^/]+)/([^/]+)/?$ page.php?name=$1&title=$2 [L]
    and you link:
    PHP Code:
    page.php?name=' .$row->item_id . '&title=' .$row->item_title . ' 
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  8. #8
    SitePoint Enthusiast Gerlof's Avatar
    Join Date
    Mar 2007
    Location
    The Netherlands
    Posts
    61
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks works great


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
  •