Mod_Rewrite Help

Discussion in 'Apache' started by xxkylexx, Feb 4, 2007.

Thread Status:
Not open for further replies.
  1. #1
    Hello there,

    I have a URL:
    http://domain.com/aboutme.php?page=resume

    I would like to use a rewrite rule to make this URL look like the following:
    http://domain.com/resume


    I've tried a few things, but can't seem to get a working solution.

    Any help is appreciated.



    Thanks,
    Kyle
     
    xxkylexx, Feb 4, 2007 IP
  2. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #2
    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteRule ^resume$ aboutme.php?page=resume [L]

    Only for that one page.
     
    Nintendo, Feb 5, 2007 IP
  3. xxkylexx

    xxkylexx Peon

    Messages:
    69
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Great, thanks!
     
    xxkylexx, Feb 9, 2007 IP
  4. audax

    audax Peon

    Messages:
    83
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #4
    How would one do it for an entire site?

    Say, I want:
    index.php?page=aboutme

    to be re-written as:
    /aboutme

    and:
    index.php?page=contact

    to be re-written as:
    /contact

    But there would be new pages added constantly? Is there a way to make it dynamic so that you don't have to change the htaccess file every time you add a new page?
     
    audax, Feb 10, 2007 IP
  5. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #5
    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteBase /
    RewriteRule ^([^.]+)$ index.php?page=$1 [L]

    If you have anything on the site that's not from that script, they won't work. Images might go wacko!
     
    Nintendo, Feb 10, 2007 IP
  6. mts

    mts Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    hello. i have a similar problem.
    i want to rewrite let's say domain.com/somepage.html to domain.com/somepage/
    i know about nothing about apache so bare with me please. i must put the code into a .htaccess file right ?
    king Nintendo, care to give a helping hand ? :)
    thank you
     
    mts, Feb 10, 2007 IP
  7. Nintendo

    Nintendo ♬ King of da Wackos ♬

    Messages:
    12,890
    Likes Received:
    1,064
    Best Answers:
    0
    Trophy Points:
    430
    #7
    Make a directory and place the file there as index.html. Mod_rewrites only good for turning dynamic URLs in to static.
     
    Nintendo, Feb 10, 2007 IP
  8. mts

    mts Peon

    Messages:
    3
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #8
    thanks for the info :)
     
    mts, Feb 11, 2007 IP
Thread Status:
Not open for further replies.