Rewrite links to work without using querystrings?

Discussion in 'PHP' started by mokimofiki, Nov 17, 2009.

  1. #1
    I got this when doing a little SEO today and have no idea how to fix it. What I currently have is:

    http://www.domain.com/page.php?blogid=17

    and this is how the blog is found and displayed obviously the 17 is different depending on which article they want to view.

    How do I Rewrite links to work without using querystrings? I assume to look something like:

    http://www.domain.com/page/17

    or any other way anyone knows how to do it. Thank you in advance.
     
    mokimofiki, Nov 17, 2009 IP
  2. innovatewebs

    innovatewebs Well-Known Member

    Messages:
    194
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    101
    #2
    innovatewebs, Nov 17, 2009 IP
  3. mokimofiki

    mokimofiki Well-Known Member

    Messages:
    444
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    130
    #3
    Thank you ... I am leaving my office now but will try this when I get home
     
    mokimofiki, Nov 17, 2009 IP
  4. mokimofiki

    mokimofiki Well-Known Member

    Messages:
    444
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    130
    #4
    Ok I put:

    Options +FollowSymLinks
    RewriteEngine on
    RewriteRule viewblog/blogid/(.*)/ viewblog.php?blogid=$1

    into my .htaccess file and when clicking on a blog title to go to a blog it still shows format as:

    http://www.mofikiworldwide.com/viewblog.php?blogid=12

    is there something that i'm doing wrong?
     
    mokimofiki, Nov 18, 2009 IP
  5. mokimofiki

    mokimofiki Well-Known Member

    Messages:
    444
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    130
    #5
    Can anyone please help me with this?
     
    mokimofiki, Nov 20, 2009 IP
  6. n3r0x

    n3r0x Well-Known Member

    Messages:
    257
    Likes Received:
    4
    Best Answers:
    1
    Trophy Points:
    120
    #6
    You have to set your blog-software to use the same format as you have in the .htaccess file.

    How you change it depends on what software you´re using.
     
    n3r0x, Nov 20, 2009 IP
  7. mokimofiki

    mokimofiki Well-Known Member

    Messages:
    444
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    130
    #7
    mokimofiki, Nov 20, 2009 IP
  8. n3r0x

    n3r0x Well-Known Member

    Messages:
    257
    Likes Received:
    4
    Best Answers:
    1
    Trophy Points:
    120
    #8
    The you have to edit the code so it generates the links in the new style.. .htaccess will NOT do it for you..

    :)
     
    n3r0x, Nov 20, 2009 IP
  9. mokimofiki

    mokimofiki Well-Known Member

    Messages:
    444
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    130
    #9
    Any chance there is example somewhere that you could show me. I am pretty good at PHP but this is giving me one heck of a time. I am so frusterated with it that I am seriously forgetting to end lines ; lol
     
    mokimofiki, Nov 20, 2009 IP
  10. n3r0x

    n3r0x Well-Known Member

    Messages:
    257
    Likes Received:
    4
    Best Answers:
    1
    Trophy Points:
    120
    #10
    Find the code part where it say
    href="http://www.mofikiworldwide.com/viewblog.php?blogid=$id
    PHP:
    and alter it to say

    href="http://www.mofikiworldwide.com/viewblog/blogid/$id/
    PHP:
    this should be done on all places where your php generates the links..
     
    n3r0x, Nov 20, 2009 IP
    mokimofiki likes this.
  11. mokimofiki

    mokimofiki Well-Known Member

    Messages:
    444
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    130
    #11
    Thank you that did it. Everything works great!
     
    mokimofiki, Nov 21, 2009 IP