.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. Advertisements

  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. Advertisements

  3. damezumari

    damezumari Guest

    Excellent Kim! Thanks!

    (Fra en nordmann til en annen. :))

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

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:
    3,082
    Stoco
    Jan 12, 2004
  2. Steve

    servlet et .htaccess

    Steve, May 6, 2004, in forum: Java
    Replies:
    1
    Views:
    1,352
    Michael Scovetta
    May 6, 2004
  3. Replies:
    1
    Views:
    671
    Michael Wojcik
    May 28, 2005
  4. David Dorward
    Replies:
    2
    Views:
    1,836
    Art Sackett
    Jun 29, 2003
  5. Craig Bennett
    Replies:
    2
    Views:
    1,147
    Craig Bennett
    Jun 29, 2003
  6. Samuël van Laere

    Charset - htaccess question

    Samuël van Laere, Jul 9, 2003, in forum: HTML
    Replies:
    9
    Views:
    4,242
    T. Audry Glamour
    Jul 9, 2003
  7. Wipkip

    htaccess & M$

    Wipkip, Jul 19, 2003, in forum: HTML
    Replies:
    11
    Views:
    971
    EightNineThree
    Jul 20, 2003
  8. Bart van den Burg

    .htaccess question

    Bart van den Burg, Sep 15, 2003, in forum: HTML
    Replies:
    3
    Views:
    610
    Bart van den Burg
    Sep 16, 2003
Loading...