2

I saw that there was something similar here
How to force rewrite to HTTPS except for a few pages in Apache?
So I would be very grateful if someone could help me with something opposite.
I need to rewrite all requests for
http://www.default.com
so I did like this:

Options FollowSymLinks
RewriteEngine On
RewriteCond %{HTTP_HOST} ^default.com
RewriteRule (.*) http://www.default.com/ [R=301,L]

and now I need to force the https protocol for some urls, like:
http://www.default.com/user/loginUser
etc.
and I really have no idea. I've been fighting with that for hours today and the closest I've got was some infinite loop of redirections :P

The other thing is that in subfolder where is CMS (written by some other guy) there is another .htaccess file with some rewrite rules and I don't know if this affect what I'm trying to do in any way.

I would be thankful for any advice.

Community
  • 1
  • 1
Neu5
  • 415
  • 4
  • 8

1 Answers1

2

For each url you need to do this:

RewriteCond %{HTTPS} off
RewriteRule ^user/loginUser(.*)$ https://www.default.com/user/LoginUser$1 [R=301,L]

RewriteCond %{HTTPS} off
RewriteRule ^another/url(.*)$ https://www.default.com/another/url$1 [R=301,L]

etc.

Jon Lin
  • 142,182
  • 29
  • 220
  • 220