I am trying to do forward all incoming requests to https, except if the url contains /axis2 (http://locatlhost/axis2) in URL. This is what I have written (in my httpd.conf file):
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/axis2$ [NC]
RewriteRule $ https://%{HTTP_HOST}%{REQUEST_URI} [L,R]
This is not working and I am unable to debug why. Can anyone help me.
Have you set up a separate
VirtualHostfor port443?if yes try removing the
__default__from theVirtualHostdirective in yourssl.conf/VirtualHostdirective set byssl.Which should look like this:
First of all I would suggest you to add this in your
VirtualHost. To log the activities ormod_rewrite. It Will be helpful for debugging and higher theRewriteLogLevelbetter for debugging.From RewriteLogLevel Docs:
Try this for your issue:
If the
%{REQUEST_URI}does not start and end with/axis2oraxis2/or/axis2/oraxis2it will redirect your URIs tohttpsand stop any further rule rewriting.Else, only this will execute:
R=301 means a permanent redirection. If just R is specified, a temporary redirect i.e. 302 will be done.