Rewriting url

Discussion in 'Apache' started by eric.r, Jan 27, 2009.

  1. #1
    Hey all. Apache / .htaccess isnt my thing so I will post here. I want (for security and other purposes) to rewrite my urls so that it will change from (for example)

    somesite.com/index.php?action=whatever

    to

    somesite.com/index.html?action=whatever

    So basically parse .php files and use .html extension instead. I googled and saw similar stuff on google but none were exactly what I needed. Thanks in advance.

    ~eric
     
    eric.r, Jan 27, 2009 IP
  2. eric.r

    eric.r Peon

    Messages:
    124
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Change that. I don't even want the html showing. :) I want

    index?action=whatever

    Thanks

    ~eric
     
    eric.r, Jan 27, 2009 IP
  3. xcrox

    xcrox Banned

    Messages:
    232
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Try this in you .htaccess file

    RewriteEngine on
    RewriteRule ^(.*)?(.*)=(.*)$ $1.php?$2=$3 [R]
     
    xcrox, Jan 30, 2009 IP
  4. eric.r

    eric.r Peon

    Messages:
    124
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Ok thanks. I am at school now and their stupid firewall blocks my cpanel. FTP won't work either sadly. *Sigh*. Thanks for the code. I was starting to worry that everyone forgot this thread.

    ~eric
     
    eric.r, Jan 30, 2009 IP