I am using Apache as a web server to rewrite urls. The pattern is simple:
if request starts with "/services" then
rewrite is off
else
using ssl. replaces http with https
So i have my own solution:
RewriteEngine On
RewriteCond %{REQUEST_URI} !^/services.* [NC]
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
Also i separate access logs by urL , one is ssl access logs and the other is none ssl access logs . What I want see is the none ssl access logs contains request only start with services .But i have found some requests in none ssl access logs likes this:
10.75.6.22 - - [28/Mar/2012:08:38:08 +0800] "GET /validate/showValidateProgress.jsp?
10.186.96.70 - - [28/Mar/2012:09:01:48 +0800] "GET /vjsp/confirm.jsp?
The requests not start with /services should using ssl unfortunately my configuration file is not working . But there is still some requests in ssl access logs which means some of the request satisfy my expectation . I am very confuse about the logs and can't figure out what's wrong with my configuration. Thanks.
That should work:
# if request starts with "/services" then rewrite is off
RewriteRule ^/services - [QSA,NC,L]
# using ssl. replaces http with https
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.