In apache 2.2 I am using mod_rewrite and I have a rewrite rule as -
RewriteCond %{REQUEST_URI} ^/?mysite/?
RewriteRule (.*)mysite/(.*) $1$2 [R=301,L]
This rewrites this url -
https://www.domain.com/mysite/about/
to
https://www.domain.com/about/
The rule seems to work. But when I see the network trace in chrome developer tools or httpwatch I can see redirects with http protocol with 302. The trace is below (I have removed the timings from trace and copied only the redirects)
GET 301 Redirect to http://www.domain.com/about https://www.domain.com/mysite/about
GET 302 Redirect to https://www.domain.com/about http://www.domain.com/about
GET 302 Redirect to http://www.domain.com/about/ https://www.domain.com/about
GET 302 Redirect to https://www.domain.com/about/ http://www.domain.com/about/
GET 200 html https://www.domain.com/about/
I would like to avoid the 302 redirects to http://...... and just have a 301 redirect as per my rewrite rule. Is there a way to do this ?