Mod_ReWrite

Discussion in 'Apache' started by mnemtsas, Jun 7, 2005.

  1. #1
    mnemtsas, Jun 7, 2005 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    29,002
    Likes Received:
    4,578
    Best Answers:
    124
    Trophy Points:
    665
    #2
    Hi Mark

    When you are starting out it's quite good to have something helpful in your new url so it doesn't get confused with other urls on the site.

    so instead of www.sitename.com/cat-name/ try
    www.sitename.com/keyword/id/cat-name/

    and then in your .htaccess file you can have

    <IfModule mod_rewrite.c>[/color]
    [color=black]RewriteEngine On[/color]
    [color=black]RewriteBase /[/color]
    [color=black]RewriteRule ^keyword/(.*)/(.*)$ /category.php?id=$1&name=$2[/color]
    [color=black]</IfModule>
    Code (markup):


    The keyword can be changed to time or files or whatever you want stuffed in there. Using the ID too can be useful because sometimes names get duplicated.

    As for generating the new urls, you just need to find all the places in your code where you write a link and update the code. It can be timeconsuming depending on the software you are working with.

    Sarah
     
    sarahk, Jun 8, 2005 IP
    mnemtsas likes this.
  3. mnemtsas

    mnemtsas Super Dud

    Messages:
    497
    Likes Received:
    40
    Best Answers:
    0
    Trophy Points:
    0
    #3
    mnemtsas, Jun 8, 2005 IP
  4. sarahk

    sarahk iTamer Staff

    Messages:
    29,002
    Likes Received:
    4,578
    Best Answers:
    124
    Trophy Points:
    665
    #4
    Happy to help. Have downloaded your timesheet software and looking forward to taking a look at that too - so we've helped each other ;)
     
    sarahk, Jun 8, 2005 IP
  5. mnemtsas

    mnemtsas Super Dud

    Messages:
    497
    Likes Received:
    40
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Hi Sarah,

    Cool, let me know if I can help you with anything in it. If you decide to buy just let me know before hand and I'll offer you a healthy discount ;)
     
    mnemtsas, Jun 8, 2005 IP