You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@httpd.apache.org by Brad Bowman <br...@atendesigngroup.com> on 2006/06/27 16:19:48 UTC
[users@httpd] Re: users Digest 27 Jun 2006 11:29:42 -0000 Issue 2505
On Jun 27, 2006, at 7:29 AM, users-digest-help@httpd.apache.org wrote:
>
> I have the following line in my httpd.conf file:
> ScriptAlias /cgi-bin/ /var/www/vhosts/site/cgi-bin/
>
> And the following two rules in .htaccess:
> RewriteRule ^random/miva(.*)$ /mm5/merchant.mvc$1 [R=301]
> RewriteRule ^cgi-bin/miva(.*)$ /mm5/merchant.mvc$1 [R=301]
>
> The first rule properly rewrites when browsing to site/random/miva?
> directives=here&more=here, while the second rule refuses to rewrite.
> I've had a terrible time finding much reliable information on the
> issue, I've found one website that claims mod_rewrite will not work
> on a directory that is a scriptalias, because scriptalias is a
> 'deeper' apache module, and therefor takes precedence before
> mod_rewrite will kick in. My personal experience on this leads me to
> believe this could be true, but since I was only able to find the
> information on one site, with nothing to back it up, I figured i'd
> see what you guys had to say about that.
>
> Thanks in advance for your time.
> -Brad Bowman
>
>
>
>
>
>
> Where is the .htaccess located? In the DocumentRoot or in the cgi-bin
> directory?
>
> The easiest fix for this would be to put the RewriteRule's in the
> httpd.conf instead of in .htaccess (with appropriate path
> adjustments).
>
> Joshua.
Previously the .htaccess file was in the document root, which I
assume is probably a mistake. This morning I came in and tried moving
the .htaccess file into the scriptalias'd cgi-bin, the contents of
that file read:
RewriteEngine on
RewriteRule ^cgi-bin/miva(.*)$ /mm5/merchant.mvc$1 [R=301]
After that failed to work, I attempted to move it into the httpd
include file that defines the virtualhost for this server, which
although was not rewriting the way I had hoped, was at least applying
the rewrite rules to the URI. Which leads me to this question, Is
mod_rewrite capable of rewriting the query string portion of the url?
The end result of what i'm hoping to do here is rewrite URI's in the
form:
http://server.com/cgi-bin/miva?Merchant2/merchant.mv
+Screen=PROD&Store_Code=server&Product_Code=ow_creme
into:
http://server.com/mm5/merchant.mvc?
Screen=PROD&Store_Code=server&Product_Code=ow_creme
is that going to be possible? I've got my RewriteLogLevel at 7, and
it seems to only include the URL in the rewrite schemes, which made
me realize i've never actually tried a rewrite on the ${QUERY_STRING}
portion of a URI.
Thanks again,
Brad
Re: [users@httpd] Re: users Digest 27 Jun 2006 11:29:42 -0000 Issue 2505
Posted by Joshua Slive <jo...@slive.ca>.
On 6/27/06, Brad Bowman <br...@atendesigngroup.com> wrote:
> Which leads me to this question, Is mod_rewrite capable of
> rewriting the query string portion of the url? The end result of what i'm
> hoping to do here is rewrite URI's in the form:
> http://server.com/cgi-bin/miva?Merchant2/merchant.mv+Screen=PROD&Store_Code=server&Product_Code=ow_creme
> into:
> http://server.com/mm5/merchant.mvc?Screen=PROD&Store_Code=server&Product_Code=ow_creme
>
> is that going to be possible? I've got my RewriteLogLevel at 7, and it seems
> to only include the URL in the rewrite schemes, which made me realize i've
> never actually tried a rewrite on the ${QUERY_STRING} portion of a URI.
Under
http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewriterule
see the big block labeled "Note: Query String".
You need to do something like
RewriteCond %{QUERY_STRING} ^(Merchant2/merchant.mv+)(.*)
RewriteRule ^/cgi-bin/miva$ /mm5/merchant.mvc?%2
But watch out: the order of parameters in the query string may be arbitrary.
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