Forum Moderators: phranque

Message Too Old, No Replies

.htaccess

passing query string

         

gosman

8:24 pm on Oct 30, 2007 (gmt 0)

10+ Year Member



Hi All

Hopefully someone can help

I'm trying to redirect

ht*p://mysite.tld/directory/1234?node=5678
To
ht*p://mysite.tld?page.php?id=1234?node=5678

I've tried the following. RewriteRule ^directory/(.*) page.php?$1

But this only passes in formation up to the?

I know this has something to do with the question mark being part of the query string but I can't figure it out.

Any help would be much appreciated.

jdMorgan

8:49 pm on Oct 30, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Use the [QSA] (query string append) flag if you wish to append new query data to the existing string:

RewriteRule ^directory/([0-9]+)$ /page.php?id=$1 [QSA,L]

Note that this code implements an internal rewrite, not an external redirect.

Jim

gosman

10:31 pm on Nov 4, 2007 (gmt 0)

10+ Year Member



Thanks Jim. Worked a treat.