简体   繁体   中英

Angularjs on https and http

I tried different ways to make only the login page to server on https and the rest of the app with http but no success.

Version: 1.2.14 Web Server: Apache 2.2

I have tried the following:

  1. Remove the # and make it pretty url but this didn't work. Tried adding locationprovider html5 enable to true and added rewrite rules in .htaccess

  2. Tried different rewritecond and rewriterule in apache to identify the login pattern and redirect to https but no luck

 RewriteEngine On RewriteCond %{SERVER_PORT} ^80$ RewriteRule ^(/?login/)$ https://www.domain.com/%{REQUEST_URI} [L,R] 

Note: My login url starts as follows:

http://www.domain.com/#/login/

Thanks

Enable

locationProvider.HTML5mode(true);

Put this to the top of your index.html file:

<html ng-app="app">
<head>
 <base href="http://www.domain/#/" />

Add this to your .htaccess file

RewriteEngine on
RewriteBase /Projects/www
# Don't rewrite files or directories
RewriteCond %{REQUEST_FILENAME} -f [OR]
RewriteCond %{REQUEST_FILENAME} -d
RewriteRule ^ - [L]

# Rewrite everything else to index.html to allow html5 state links
RewriteRule ^ index.html [L]

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM