使用HTTPS除某些文件夹(不同的域)

时间:2017-03-15 14:29:08

标签: php apache .htaccess ssl redirect

这是我的 htaccess

import org.junit.BeforeClass;
import org.junit.Before;
import org.junit.ClassRule;

import au.com.dius.pact.provider.junit.State;
import au.com.dius.pact.provider.junit.Provider;
import au.com.dius.pact.provider.junit.target.TestTarget;
import au.com.dius.pact.provider.junit.target.Target;
import au.com.dius.pact.provider.junit.target.HttpTarget;
import au.com.dius.pact.provider.junit.TargetRequestFilter;

import org.apache.http.HttpRequest;


import au.com.dius.pact.provider.junit.PactRunner;
import au.com.dius.pact.provider.junit.loader.PactFolder;
import au.com.dius.pact.provider.junit.loader.PactUrl;
import au.com.dius.pact.provider.junit.VerificationReports;

import com.github.restdriver.clientdriver.ClientDriverRule;

import org.junit.runner.RunWith;
import org.slf4j.LoggerFactory;

import org.slf4j.Logger;

import static com.github.restdriver.clientdriver.RestClientDriver.giveEmptyResponse;
import static com.github.restdriver.clientdriver.RestClientDriver.onRequestTo;



@RunWith(PactRunner.class) // Say JUnit to run tests with custom Runner
@Provider("uicc_repository") // Set up name of tested provider
//@PactFolder("rs") // Point where to find pacts (See also section Pacts source in documentation)
@PactUrl(urls = {"file:///C:/IdeaProjects/src/pack-test-provider/resources/test_consumer-test_provider.json"}) // Point where to find pacts (See also section Pacts source in documentation)
@VerificationReports(value = {"markdown","json"}, reportDir = "C:/IdeaProjects/src/pack-test-provider/resources")

public class ContractTest {


    // NOTE: this is just an example of embedded service that listens to requests, you should start here real service
    @ClassRule //Rule will be applied once: before/after whole contract test suite
    public static final ClientDriverRule embeddedService = new ClientDriverRule(6060);
    private static final Logger LOGGER = LoggerFactory.getLogger(ContractTest.class);

    @BeforeClass //Method will be run once: before whole contract test suite
    public static void setUpService() {
        //Run DB, create schema
        //Run service
        //...
    }

    @Before //Method will be run before each test of interaction
    public void before() {
        // Rest data
        // Mock dependent service responses
        // ...
        embeddedService.addExpectation(
                onRequestTo("/data"), giveEmptyResponse()
        );
    }

    @TestTarget // Annotation denotes Target that will be used for tests
    public final Target target = new HttpTarget(6060); // Out-of-the-box implementation of Target (for more information take a look at Test Target section)

    @State("default") // Method will be run before testing interactions that require "default" or "no-data" state
    public void toDefaultState() {
        // Prepare service before interaction that require "default" state
        // ...
        System.out.println("Now service in default state");
        LOGGER.info("Now service in default state");
    }
}

我有# All access http to https RewriteEngine On RewriteCond %{HTTPS} off RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301] # all access with www to without www and https RewriteEngine On RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] RewriteRule ^(.*)$ https://%1%{REQUEST_URI} [R=301,QSA,NC,L] # all access redirect to index.php RewriteCond %{REQUEST_URI} !^/(media|skin|js)/ RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteCond %{REQUEST_FILENAME} !-l RewriteRule .* index.php [L] 个网站

1:使用此htaccess和HTTPS的根3上的主网站

2和3:其他没有SSL证书(http访问)的网站,如文件夹/和文件夹/mysite.com.br上的其他网站,我希望重定向所有访问权限站点/到SSL,但不重定向其他站点的子文件夹。

我已经尝试了这个但是不起作用https://stackoverflow.com/a/17638936/2761794

注意:我认为在重定向到正确的站点之前,主机首先通过主站点并读取根文件夹/myothersite.com.br上的htaccess,并且由于根目录中的htaccess配置不正确,重定向正在错误地完成......

0 个答案:

没有答案