You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Stephen Brooks <sb...@stephenbrooks.org> on 2006/09/12 16:25:51 UTC

[users@httpd] Can I modify the page query string?

I've got a hosted Apache server without mod_rewrite and am editing an 
.htaccess file.
I want to do something like this:

RedirectMatch ^/muon1/banner_(.*)\.jpg$ 
http://stephenbrooks.org/muon1/banner.php?user=$1

...so that filenames such as /muon1/banner_me.jpg are served by the script 
/muon1/banner.php?user=me on stephenbrooks.org (my server).

However, the above rule escapes the question mark into a %3f, interpreting 
the whole thing as the URL and the complaining a file with a question mark 
in its name is not found!  I played with:

SetEnv QUERY_STRING <something>

...and various conditional rules for a while, but haven't had much success. 
In fact, I don't even seem to be able to set the query string in a way that 
a PHP script will pick up.  Does Apache even allow this?  (Relatedly, does 
this require mod_rewrite?)
Any help or advice would be much appreciated.

    -Stephen 


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Can I modify the page query string?

Posted by Stephen Brooks <sb...@stephenbrooks.org>.
--[Yes, you need mod_rewrite:]--

Thanks.  Next step is then persuading my webhost to install it.  :)

    -Stephen


----- Original Message ----- 
From: "Joshua Slive" <jo...@slive.ca>
To: <us...@httpd.apache.org>
Sent: Tuesday, September 12, 2006 5:02 PM
Subject: Re: [users@httpd] Can I modify the page query string?


> On 9/12/06, Stephen Brooks <sb...@stephenbrooks.org> wrote:
>> I've got a hosted Apache server without mod_rewrite and am editing an
>> .htaccess file.
>> I want to do something like this:
>>
>> RedirectMatch ^/muon1/banner_(.*)\.jpg$
>> http://stephenbrooks.org/muon1/banner.php?user=$1
>>
>> ...so that filenames such as /muon1/banner_me.jpg are served by the 
>> script
>> /muon1/banner.php?user=me on stephenbrooks.org (my server).
>>
>> However, the above rule escapes the question mark into a %3f, 
>> interpreting
>> the whole thing as the URL and the complaining a file with a question 
>> mark
>> in its name is not found!  I played with:
>>
>> SetEnv QUERY_STRING <something>
>>
>> ...and various conditional rules for a while, but haven't had much 
>> success.
>> In fact, I don't even seem to be able to set the query string in a way 
>> that
>> a PHP script will pick up.  Does Apache even allow this?  (Relatedly, 
>> does
>> this require mod_rewrite?)
>> Any help or advice would be much appreciated.
>
> Yes, you need mod_rewrite:
> RewriteEngine On
> RewriteRule ^/muon1/banner_(.*)\.jpg$
> http://stephenbrooks.org/muon1/banner.php?user=$1 [R]
>
> Joshua.
>
> ---------------------------------------------------------------------
> The official User-To-User support forum of the Apache HTTP Server Project.
> See <URL:http://httpd.apache.org/userslist.html> for more info.
> To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
>   "   from the digest: users-digest-unsubscribe@httpd.apache.org
> For additional commands, e-mail: users-help@httpd.apache.org
> 


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Re: [users@httpd] Can I modify the page query string?

Posted by Joshua Slive <jo...@slive.ca>.
On 9/12/06, Stephen Brooks <sb...@stephenbrooks.org> wrote:
> I've got a hosted Apache server without mod_rewrite and am editing an
> .htaccess file.
> I want to do something like this:
>
> RedirectMatch ^/muon1/banner_(.*)\.jpg$
> http://stephenbrooks.org/muon1/banner.php?user=$1
>
> ...so that filenames such as /muon1/banner_me.jpg are served by the script
> /muon1/banner.php?user=me on stephenbrooks.org (my server).
>
> However, the above rule escapes the question mark into a %3f, interpreting
> the whole thing as the URL and the complaining a file with a question mark
> in its name is not found!  I played with:
>
> SetEnv QUERY_STRING <something>
>
> ...and various conditional rules for a while, but haven't had much success.
> In fact, I don't even seem to be able to set the query string in a way that
> a PHP script will pick up.  Does Apache even allow this?  (Relatedly, does
> this require mod_rewrite?)
> Any help or advice would be much appreciated.

Yes, you need mod_rewrite:
RewriteEngine On
RewriteRule ^/muon1/banner_(.*)\.jpg$
http://stephenbrooks.org/muon1/banner.php?user=$1 [R]

Joshua.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org