1

I have an angular application that uses ui-router for routing between different states. Mainly /#/ and /#/login. I am also using SSL, so I redirect http to https in my .htaccess-file. It works when I go to test.example.com/#/ but when I go directly to test.example.com/#/login the redirect does not work.

Note that we use a subdomain.

.htaccess look like this:(stolen from htaccess redirect to https://www)

RewriteCond %{HTTPS} off
# First rewrite to HTTPS:
# Don't put www. here. If it is already there it will be included, if not
# the subsequent rule will catch it.
RewriteRule .* https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
# Now, rewrite any request to the wrong domain to use www.
RewriteCond %{HTTP_HOST} !^www\.
RewriteRule .* https://www.%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Thanks.

Community
  • 1
  • 1
Inzajt
  • 135
  • 2
  • 13
  • I'm actually not working on my apache conf for my own project and did this myself on my login controller : if ($location.protocol() != 'https'){ $window.location.href = $location.absUrl().replace('http', 'https'); }; but that's actually not sexy at all. I'd pref to see a clean apache solution so... thumbs up ! – Okazari Jul 15 '15 at 14:43
  • Thanks! Will try that and hope for someone to provide a "cleaner" solution :) – Inzajt Jul 15 '15 at 15:11

0 Answers0