rewrite rule not working in Apache2.0

Using a single web hosting account to host multiple sites

rewrite rule not working in Apache2.0

Postby sjwood0 » Wed Feb 28, 2007 3:41 am

Hello All

I'd be very grateful of some Apache Gurus help with this. I have a rewrite rule that was previously working fine on an Apache1.3 but doesn't work on Apache2.0. Looking at the rewrite log the rewrite bit works OK and it's down to what apache does when a path you type in isn't there(because in this case it's a parameter I'm passing to something else). How do I change my setup so Apache doesn't see this as a forbidden request???

Here's the address I type in... http://some-server.com/parameter/sss
In Apache1.3 this gets a "400 Bad Request" error but the proxy/rewrite bit works
In Apache2.0 this gets a "403 Forbidden" error and doesn't


And the httpd.conf entry (same in both servers)....
<VirtualHost _default_:80>
ServerName some-server.com
DocumentRoot "/opt/apache2/htdocs"
RewriteEngine On
RewriteLog "/opt/apache2/logs/rewrite1.log"
RewriteLogLevel 9
RewriteCond %{REQUEST_URI} ^/parameter/([a-zA-Z0-9_]+)$ [NC]
RewriteRule ^/parameter/([a-zA-Z0-9_]+)$ http://sometomcatserver.com?urlsuffix=$1&ipaddress=%{REMOTE_ADDR} [P]
</VirtualHost>


Heres a snip of the 1.3 rewrite log showing it working.....

192.168.219.192 - - [28/Feb/2007:10:54:07 +0000] [some-server.com/sid#ad70
8][rid#c7d70/initial] (3) split uri=http://sometomcatserver.com?urlsuffix=sss&ipaddress=192.168.219.192 -> uri=http://sometomcatserver.com, args=urlsuffix=sss&ipaddress=192.168.219.192
192.168.219.192 - - [28/Feb/2007:10:54:07 +0000] [some-server.com/sid#ad70
8][rid#c7d70/initial] (2) forcing proxy-throughput with http://sometomcatserver.com
192.168.219.192 - - [28/Feb/2007:10:54:07 +0000] [some-server.com/sid#ad70
8][rid#c7d70/initial] (1) go-ahead with proxy request proxy:http://sometomcatserver.com [OK]


And a snip of the 2.0 rewrite log showing it NOT working.....

6cc10/initial] (3) applying pattern '^/parameter/([a-zA-Z0-9_]+)$' to uri '/parameter/sss'
64.35.70.108 - - [28/Feb/2007:10:17:42 +0000] [sometomcatserver.com/sid#81259b0][rid#816cc10/initial] (4) RewriteCond: input='/parameter/sss' pattern='^/parameter/([a-zA-Z0-9_]+)$' => matched
64.35.70.108 - - [28/Feb/2007:10:17:42 +0000] [sometomcatserver.com/sid#81259b0][rid#816cc10/initial] (2) rewrite /parameter/sss -> http://sometomcatserver.com?urlsuffix=s ... .35.70.108
64.35.70.108 - - [28/Feb/2007:10:17:42 +0000] [sometomcatserver.com/sid#81259b0][rid#816cc10/initial] (3) split uri=http://sometomcatserver.com?urlsuffix=sss&ipaddress=64.35.70.108 -> uri=http://sometomcatserver.com, args=urlsuffix=sss&ipaddress=64.35.70.108
64.35.70.108 - - [28/Feb/2007:10:17:42 +0000] [sometomcatserver.com/sid#81259b0][rid#816cc10/initial] (2) forcing proxy-throughput with http://sometomcatserver.com
sjwood0
 
Posts: 2
Joined: Wed Feb 28, 2007 3:38 am

Postby richardk » Fri Mar 02, 2007 10:55 am

Which server is sending the forbidden error? Is it in your Apache error log?

Try
Code: Select all
RewriteEngine On

RewriteLog "/opt/apache2/logs/rewrite1.log"
RewriteLogLevel 9

RewriteRule ^/parameter/([a-z0-9_]+)$ http://sometomcatserver.com/?urlsuffix=$1&ipaddress=%{REMOTE_ADDR} [NC,P,L]
richardk
 
Posts: 8800
Joined: Wed Dec 21, 2005 7:50 am

Postby sjwood0 » Fri Mar 09, 2007 3:29 am

Hi Richard

The apache2 server gives the forbidden error. I'll try your suggestion and let you know if I have any success.

Cheers

Steve
sjwood0
 
Posts: 2
Joined: Wed Feb 28, 2007 3:38 am


Return to Domain Handling

Who is online

Users browsing this forum: No registered users and 81 guests

cron