.htaccess


D

damezumari

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
 
Ad

Advertisements

K

Kim André Akerø

damezumari said:
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
 
Ad

Advertisements


Ask a Question

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

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top