Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > HTML > .htaccess

Reply
Thread Tools

.htaccess

 
 
damezumari
Guest
Posts: n/a
 
      06-10-2008
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
 
Reply With Quote
 
 
 
 
Kim André Akerĝ
Guest
Posts: n/a
 
      06-10-2008
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...ml#rewriterule

--
Kim André Akerĝ
-
(remove NOSPAM to contact me directly)
 
Reply With Quote
 
 
 
 
damezumari
Guest
Posts: n/a
 
      06-10-2008
Excellent Kim! Thanks!

(Fra en nordmann til en annen. )

Jan Nordgreen
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57