I'd like redirect access to a url from http to https for only a couple of pages on my website.
I know how to do it for a whole site using the rewrite in apache virtual hosts:
RewriteEngine On
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule (.*) https://%{SERVER_NAME}%{REQUEST_URI}
But is there a way to do it for one page of the site? E.g. "www.example.com/protected-page"
Try this
RewriteRule ^/protected-page/(.*) https://example.com/protected-page/$1 [R,L]
reference : http://httpd.apache.org/docs/current/rewrite/intro.html
I ended up doing something different, and secured everything but a page that didn't work if it was protected: