Mod_Rewrite + MySQL Advice

Discussion in 'Apache' started by herpsuk, Nov 4, 2009.

  1. #1
    Hi guys,

    so im goign to be doing a website that runs a mysql database and uses mod_rewrite to change the urls to seo friendly ones. The problem im coming up against when thinking about it is....

    When i use MySQL to show a list of categories on a page it will normally show the original URL with ID and so on. Does mod_rewrite rewrite these as they are coded on the page so it shows as a seo friendly url? or is there some other way of doing it?

    Also how do i get to use the title from a new articles or the page title as the seo url? Can i grab the title from the database and add - inbetween each word?

    any help would be appreciated

    Jonathan
     
    herpsuk, Nov 4, 2009 IP
  2. smcblogger

    smcblogger Peon

    Messages:
    28
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    This would be a mod rewrite using .htaccess. If you do a search, there are places that will give you examples, and there are a few that will actually make a rewrite rule for you (if it's not too complicated). A general idea is: If your url is some.calm/page.php?category=test&page_number=2 the rewrite would allow access to the page via some.calm/category/page2.html (or some variation that you specify). The rewrite rule looks for a variable(s), in this case category and page_number, and (assuming it's written correctly) places 'test' and '2' in the rewrite where specified.
     
    smcblogger, Nov 4, 2009 IP
  3. partysoft

    partysoft Peon

    Messages:
    6
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    well i don't think that's posible...you can't mix mod_rewrite with mysql , you have to solve it from the php itself...
     
    partysoft, Nov 5, 2009 IP