.htaccess

Discussion in 'HTML' started by damezumari, Jun 10, 2008.

  1. damezumari

    damezumari Guest

    My current .htaccess file looks like this:

    Options +Indexes
    Options +FollowSymlinks
    RewriteEngine on
    RewriteRule ^(.*).html$ index.php?page=$1 [L]

    So when the url is test.html it is redirected to index.php?page=test.

    I would like to send a parameter like this: test.html?id=8 and have it
    redirected to index.php?page=test&id=8.

    How do I change the rewriterule to achieve that?

    If there is no argument in the html page it shall be redirected like
    it was before.

    Kind regards,

    Jan Nordgreen
     
    damezumari, Jun 10, 2008
    #1
    1. Advertising

  2. damezumari wrote:

    > My current .htaccess file looks like this:
    >
    > Options +Indexes
    > Options +FollowSymlinks
    > RewriteEngine on
    > RewriteRule ^(.*).html$ index.php?page=$1 [L]
    >
    > So when the url is test.html it is redirected to index.php?page=test.
    >
    > I would like to send a parameter like this: test.html?id=8 and have it
    > redirected to index.php?page=test&id=8.
    >
    > How do I change the rewriterule to achieve that?


    RewriteRule ^(.*).html$ index.php?page=$1 [L,QSA]

    QSA stands for "Query String Append"
    http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriterule

    --
    Kim André Akerø
    -
    (remove NOSPAM to contact me directly)
     
    Kim André Akerø, Jun 10, 2008
    #2
    1. Advertising

  3. damezumari

    damezumari Guest

    Excellent Kim! Thanks!

    (Fra en nordmann til en annen. :))

    Jan Nordgreen
     
    damezumari, Jun 10, 2008
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Stoco

    .htaccess and perl cgi

    Stoco, Jan 12, 2004, in forum: Perl
    Replies:
    0
    Views:
    2,915
    Stoco
    Jan 12, 2004
  2. Steve

    servlet et .htaccess

    Steve, May 6, 2004, in forum: Java
    Replies:
    1
    Views:
    1,201
    Michael Scovetta
    May 6, 2004
  3. Replies:
    1
    Views:
    597
    Michael Wojcik
    May 28, 2005
  4. David Dorward
    Replies:
    2
    Views:
    1,724
    Art Sackett
    Jun 29, 2003
  5. John Bokma
    Replies:
    0
    Views:
    893
    John Bokma
    Jun 28, 2003
Loading...

Share This Page