top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

Rewrite rule in Apache [CLOSED]

+2 votes
433 views

I encounter problems to rewrite a rule
The page /cgi-bin/blt?action=cs_query is now gone and I would like to notify this.

I tried the following thing without success.

RewriteEngine on
RewriteRule ^/cgi-bin/blt?action=cs_query$ - [G]

An suggestions?

closed with the note: Problem Solved
posted Apr 30, 2014 by Dewang Chaudhary

Looking for an answer?  Promote on:
Facebook Share Button Twitter Share Button LinkedIn Share Button
mod_rewrite matches the URi not the the query string. Read about RewriteCond at the following link: http://httpd.apache.org/docs/2.2/mod/mod_rewrite.html#rewritecond
I tried
RewriteCond %{REQUEST_URI} ^(cgi-bin/blt?action=cs_query)$
RewriteRule ^1$ - [G]
or
RewriteCond %{QUERY_STRING} ^action=cs_query$
RewriteRule ^/cgi-bin/blt?action=cs_query$ - [G]

without more success.
As I said before, you cant include the query string in RewriteRule statement.
 
This is perfect now.  Thanks

Similar Questions
0 votes

I have problems making successfully a rewrite rule for my Webapplication (CodeIgniter) with mod_rewrite.

In my ".htaccess" file, I have the following rewrite rules:

RewriteEngine on
RewriteRule ^[css|js|fonts](/.*)?$ /static$1 [L]
RewriteRule ^(.*)$ /index.php/$1 [L]

But the 1st rule doesn't work, neither I know if the rule was correct.

I want first:

/css/* -> /static/css/*
,/js/* -> /static/css/*
/fonts/* -> /static/fonts/*

and anything else

/index.php/

The second rule seems to work. But the 1st rule makes me headache.

+1 vote

Just set up a FreeBSD jail to run httpd in it and all works good except these two, rewrite/proxy modules.

These are error logs excerpts:

MOD_REWRITE error: 
[rewrite:crit] [pid 43447] (13)Permission denied: AH00666: mod_rewrite: could not init rewrite_mapr_lock_acquire in child 
MOD_PROXYÂ error: 
[proxy:crit] [pid 43447] (13)Permission denied: AH02479: could not init proxy_mutex in child 

Not sure permissions of what are being denied as html in document root is being served just fine when these modules are disabled.

I tried googling but found nothing but rubbish. Please help?

+2 votes

I want to run three virtual hosts on separate IP addresses for notification messages (the reason is due to how the network kit does the redirection of traffic)

On each of these virtual hosts I want a request for any URI to be sent to the document root default (/index.html or just /)

What the best way to achieve this per virtual host?

0 votes

After looking this over I've located the issue but haven't determined how to best implement the resolution.

The problem is that when folks access HTTP (via httpd-vhosts.conf) the configuration Rewrites the URL as https://www.yippyskippy.com/ClusterTester$1

When end-users bypass the HTTP configuration and go directly to HTTPS the httpd-ssl.conf file has been configured to expect that the Rewrite has already occurred and that the /ClusterTester$1 suffix already exists.

Because the original httpd-vhosts.conf Rewrite command is bypassed, the httpd-ssl.conf configuration tries to proxypass the incorrect URL string to the back-end Glassfish server resulting in the original error.

Now I'm trying to determine how/where to best place the Rewrite command (I'm assuming within the httpd-ssl.conf virtual hosts section) while still maintaining the redirect from HTTP to HTTPS.

...