RewriteCond not working in this scenario !
am 12.11.2007 23:22:09 von onewebclick
I have the below apache configuration ... basically want to rewrite
all https requests to http except for the signup url /mytestdev/SignUp/
SignUp.jsp and similarly even the http request goes to signup url /
mytestdev/SignUp/SignUp.jsp and want to force it to https.. basically
to force the signup url to be https.
In this below case it doesn't work when the request goes to
http://ws.dev.test.com/
mytestdev/SignUp/SignUp.jsp it' s just not rewrite to https but if it
goes to https ... it keeps it as https by checking the condition .
Other strange thing is it i use entire URI /mytestdev/SignUp/
SignUp.jsp instead of the pattern =.*/SignUp/.* then it works.... can
you help why os is there any other way we can fix ?
ServerName ws.dev.test.com
ServerAlias ws.dev.testone.com
ServerAdmin internic@test.com
DocumentRoot "/cust/webserver/ibmihs2c/htdocs"
RewriteEngine on
RewriteLogLevel 3
RewriteLog logs/ws.dev.test.com-rewrite_log
#RewriteCond %{REQUEST_URI} =/mytestdev/SignUp/SignUp.jsp
RewriteCond %{REQUEST_URI} =.*/SignUp/.*
RewriteRule ^/(.*) https://ws.dev.test.com/$1 [L,R]
ErrorDocument 404 /index.html
ErrorDocument 500 https://ws.dev.test.com/maint/test.html
ErrorLog logs/ws.dev.test.com-error_log
CustomLog logs/ws.dev.test.com-access_log common
#
# CoreDumpDirectory directory: Sets the location where the server will
# attempt to put a core dump. Make sure IBM HTTP Server child
# processes running as 'User' (see User config directive above) have
# permission to write to the corefiles directory. The filesystem
# will have to be large enough to hold potentially large core files.
#
#CoreDumpDirectory "/cust/webserver/ibmihs2c/corefiles"
ServerName ws.dev.test.com
ServerAlias ws.dev.testone.com
ServerAdmin internic@test.com
ErrorLog logs/ws.dev.test.com-error_log
CustomLog logs/ws.dev.test.com-access_log combined
TransferLog logs/access_log
DocumentRoot "/cust/webserver/ibmihs2c/htdocs"
RewriteEngine on
RewriteLogLevel 3
RewriteLog logs/ws.dev.test.com-rewrite_log
RewriteCond %{REQUEST_URI} !.*/SignUp/.*
RewriteRule ^/(.*) http://ws.dev.test.com/$1 [L,R]
ErrorDocument 500 https://ws.dev.test.com/maint/canvasmaintenance.html
SSLEnable
ServerName ws.dev.test.com
SSLServerCert ws.dev.test.com
Re: RewriteCond not working in this scenario !
am 31.12.2007 03:25:25 von onewebclick
On Nov 12, 2:22=A0pm, onewebclick wrote:
> I have the below apache configuration ... basically want to rewrite
> all https requests to http except for the signup url /mytestdev/SignUp/
> SignUp.jsp and similarly even the http request goes to signup url /
> mytestdev/SignUp/SignUp.jsp and want to force it to https.. basically
> to force the signup url to be https.
>
> In this below case it doesn't work when the request goes tohttp://ws.dev.t=
est.com/
> mytestdev/SignUp/SignUp.jsp it' s just not rewrite to https but if it
> goes to https ... it keeps it as https by checking the condition .
> Other strange thing is it i use entire URI /mytestdev/SignUp/
> SignUp.jsp instead of the pattern =3D.*/SignUp/.* then it works.... can
> you help why os is there any other way we can fix ?
>
>
> =A0 =A0 =A0 =A0 ServerName ws.dev.test.com
> =A0 =A0 =A0 =A0 ServerAlias ws.dev.testone.com
> =A0 =A0 =A0 =A0 ServerAdmin inter...@test.com
> =A0 =A0 =A0 =A0 DocumentRoot "/cust/webserver/ibmihs2c/htdocs"
> =A0 =A0 =A0 =A0 RewriteEngine on
> =A0 =A0 =A0 =A0 RewriteLogLevel 3
> =A0 =A0 =A0 =A0 RewriteLog logs/ws.dev.test.com-rewrite_log
> =A0 =A0 =A0 =A0 #RewriteCond %{REQUEST_URI} =3D/mytestdev/SignUp/SignUp.js=
p
> =A0 =A0 =A0 =A0 RewriteCond %{REQUEST_URI} =3D.*/SignUp/.*
> =A0 =A0 =A0 =A0 RewriteRule ^/(.*)https://ws.dev.test.com/$1[L,R]
> =A0 =A0 =A0 =A0 ErrorDocument 404 /index.html
> =A0 =A0 =A0 =A0 ErrorDocument 500https://ws.dev.test.com/maint/test.html
> =A0 =A0 =A0 =A0 ErrorLog logs/ws.dev.test.com-error_log
> =A0 =A0 =A0 =A0 CustomLog logs/ws.dev.test.com-access_log common
>
> #
> # CoreDumpDirectory directory: Sets the location where the server will
> # attempt to put a core dump. Make sure IBM HTTP Server child
> # processes running as 'User' (see User config directive above) have
> # permission to write to the corefiles directory. The filesystem
> # will have to be large enough to hold potentially large core files.
> #
> #CoreDumpDirectory "/cust/webserver/ibmihs2c/corefiles"
>
> =A0 =A0 =A0 =A0ServerName ws.dev.test.com
> =A0 =A0 =A0 =A0ServerAlias ws.dev.testone.com
> =A0 =A0 =A0 =A0ServerAdmin inter...@test.com
> =A0 =A0 =A0 =A0ErrorLog logs/ws.dev.test.com-error_log
> =A0 =A0 =A0 =A0CustomLog logs/ws.dev.test.com-access_log combined
> =A0 =A0 =A0 =A0TransferLog logs/access_log
> =A0 =A0 =A0 =A0DocumentRoot "/cust/webserver/ibmihs2c/htdocs"
> =A0 =A0 =A0 =A0RewriteEngine on
> =A0 =A0 =A0 =A0RewriteLogLevel 3
> =A0 =A0 =A0 =A0RewriteLog logs/ws.dev.test.com-rewrite_log
> =A0 =A0 =A0 =A0RewriteCond %{REQUEST_URI} !.*/SignUp/.*
> =A0 =A0 =A0 =A0RewriteRule ^/(.*)http://ws.dev.test.com/$1[L,R]
> =A0 =A0 =A0 =A0ErrorDocument 500https://ws.dev.test.com/maint/canvasmainte=
nance.html
> =A0 =A0 =A0 =A0SSLEnable
> =A0 =A0 =A0 =A0ServerName ws.dev.test.com
> =A0 =A0 =A0 =A0SSLServerCert ws.dev.test.com
>
>
I was able to find the solution that i need to remove the =3D for the
redirects definition for virtualhost:80 it should be looking like
one ,
ServerName ws.dev.test.com
ServerAlias ws.dev.testone.com
ServerAdmin inter...@test.com
DocumentRoot "/cust/webserver/ibmihs2c/htdocs"
RewriteEngine on
RewriteLogLevel 3
RewriteLog logs/ws.dev.test.com-rewrite_log
#RewriteCond %{REQUEST_URI} /mytestdev/SignUp/SignUp.jsp
RewriteCond %{REQUEST_URI} .*/SignUp/.*
<===3D without the "=3D" -- seems to have resolved the issue
RewriteRule ^/(.*) https://ws.dev.test.com/$1 [L,R]
ErrorDocument 404 /index.html
ErrorDocument 500 https://ws.dev.test.com/maint/test.html
ErrorLog logs/ws.dev.test.com-error_log
CustomLog logs/ws.dev.test.com-access_log common
#
# CoreDumpDirectory directory: Sets the location where the server
will
# attempt to put a core dump. Make sure IBM HTTP Server child
# processes running as 'User' (see User config directive above) have
# permission to write to the corefiles directory. The filesystem
# will have to be large enough to hold potentially large core files.
#
#CoreDumpDirectory "/cust/webserver/ibmihs2c/corefiles"
ServerName ws.dev.test.com
ServerAlias ws.dev.testone.com
ServerAdmin inter...@test.com
ErrorLog logs/ws.dev.test.com-error_log
CustomLog logs/ws.dev.test.com-access_log combined
TransferLog logs/access_log
DocumentRoot "/cust/webserver/ibmihs2c/htdocs"
RewriteEngine on
RewriteLogLevel 3
RewriteLog logs/ws.dev.test.com-rewrite_log
RewriteCond %{REQUEST_URI} !.*/SignUp/.*
RewriteRule ^/(.*) http://ws.dev.test.com/$1 [L,R]
ErrorDocument 500 https://ws.dev.test.com/maint/canvasmaintenance.htm=
l
SSLEnable
ServerName ws.dev.test.com
SSLServerCert ws.dev.test.com