[users@httpd] Re: users Digest 27 Jun 2006 11:29:42 -0000 Issue 2505

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 




On Jun 27, 2006, at 7:29 AM, users-digest-help@xxxxxxxxxxxxxxxx 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

[Index of Archives]     [Open SSH Users]     [Linux ACPI]     [Linux Kernel]     [Linux Laptop]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Squid]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux