Rewriting MMy Urls..

Discussion in 'Apache' started by bquast, Nov 16, 2007.

  1. #1
    Well take a look at http://www.worldofwarcraftmacros.com

    first thing, my links are all index.php?id=5 or ?id=about lets say, now what I need to do is change that to .html, say id 5 =apple now what I want to do is change that to apple.html if the id = 5 and if the id = 6 change that to something different..

    I have searched google and could not figure it out, but if you can help out that would be wonderful.

    thanks,
    Brett
     
    bquast, Nov 16, 2007 IP
  2. pig2cat

    pig2cat Active Member

    Messages:
    299
    Likes Received:
    6
    Best Answers:
    0
    Trophy Points:
    60
    #2
    you can do this via multiple ways:
    manualy:
    in .HTACCESS


    RewriteEngine on
    RewriteBase /
    RewriteRule ^changethese.html$ index.php?id=1
    RewriteRule ^lalal.html$ index.php?id=2
    RewriteRule ^moo.html$ index.php?id=3
    RewriteRule ^pie.html$ index.php?id=4
    RewriteRule ^Apple.html$ index.php?id=5 (i think the last one needs [L] but i'm not sure)

    or you can do it like this:

    RewriteEngine On
    RewriteBase /

    RewriteRule ^([^/]*)\-([^/]*)\.html$ /index.php?id=$1 [L]

    this way if you enter yoursite.com/5-apple.html it goes to the ?id=5 or if you enter about-1.html it goes to ?id=about
    just typed this by heart and havent tested them, but it should work
     
    pig2cat, Nov 17, 2007 IP
  3. bquast

    bquast Active Member

    Messages:
    275
    Likes Received:
    8
    Best Answers:
    0
    Trophy Points:
    78
    #3
    awesome that works good but then some of my links like my navigation to make it pop down etc do not have anything in the <a href=""> so it changes the links to whatever page i chose that is rewritten...

    thanks for your help.
     
    bquast, Nov 17, 2007 IP