Variable no of GET elements

This is a discussion on Variable no of GET elements within the Apache Web Server forums, part of the Web Server and Related Forums category; Hi, How could I configure the htaccess file to do: test.html?var1=test ---> test.php?var1=test AND ...


Go Back   Usenet Forums > Web Server and Related Forums > Apache Web Server

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 06-24-2008
UKuser
 
Posts: n/a
Default Variable no of GET elements

Hi,

How could I configure the htaccess file to do:

test.html?var1=test ---> test.php?var1=test
AND
test.html?var1=test&var2=test&var3=test -->test.php?
var1=test&var2=test&var3=test

In short - passing a variable number of GET elements to the new file
whilst rewrite is on.

Many thanks

A
  #2 (permalink)  
Old 06-24-2008
lihao0129@gmail.com
 
Posts: n/a
Default Re: Variable no of GET elements

On Jun 24, 9:16*am, UKuser <spiderc...@yahoo.co.uk> wrote:
> Hi,
>
> How could I configure the htaccess file to do:
>
> test.html?var1=test ---> test.php?var1=test
> AND
> test.html?var1=test&var2=test&var3=test -->test.php?
> var1=test&var2=test&var3=test
> In short - passing a variable number of GET elements to the new file
> whilst rewrite is on.


All you need is the `QSA` flag in RewriteRule, say in your .htaccess:

RewriteEngine On
RewriteBase /
RewriteRule ^test.html$ test.php [QSA,L,PT]

[untested]

lihao
  #3 (permalink)  
Old 06-24-2008
UKuser
 
Posts: n/a
Default Re: Variable no of GET elements

On Jun 24, 2:43*pm, "lihao0...@gmail.com" <lihao0...@gmail.com> wrote:
> On Jun 24, 9:16*am, UKuser <spiderc...@yahoo.co.uk> wrote:
>
> > Hi,

>
> > How could I configure the htaccess file to do:

>
> > test.html?var1=test ---> test.php?var1=test
> > AND
> > test.html?var1=test&var2=test&var3=test -->test.php?
> > var1=test&var2=test&var3=test
> > In short - passing a variable number of GET elements to the new file
> > whilst rewrite is on.

>
> All you need is the `QSA` flag in RewriteRule, say in your .htaccess:
>
> RewriteEngine On
> RewriteBase /
> RewriteRule ^test.html$ test.php [QSA,L,PT]
>
> [untested]
>
> lihao


Great thanks for your help! (the RewriteBase / caused an issue but
without it - was great)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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 Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT +1. The time now is 06:29 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0