2014-03-14 75 views
0

我嘗試了不同的方法,使得只有登錄頁面上的服務器上HTTPS和應用程序的其餘部分與HTTP但沒有成功。https和http上的Angularjs

版本:1.2.14 的Web服務器:Apache 2.2

我曾嘗試以下:

  1. 刪除#並使其美觀的網址,但並沒有工作。嘗試添加locationprovider HTML5能夠爲true,並添加重寫規則在.htaccess

  2. 嘗試了不同的RewriteCond和重寫規則在Apache來標識登錄模式和重定向到https,但沒有運氣

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

注:我的登錄URL開始如下:

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

感謝

+0

從任何幫助任何人。 – John

回答

0

啓用

locationProvider.HTML5mode(true); 

將這個你index.html文件的頂部:

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

添加到您的.htaccess文件

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] 
+0

這對我的場景沒有幫助,我希望在https中使用一些頁面,而在http上使用其他頁面。 – John