如何使用htaccess从特定URL或页面中删除ssl

时间:2016-03-01 05:26:57

标签: .htaccess ssl

我有一个ssl网站。网站上的所有页面都通过www。

重定向到https

我希望以下网址为非ssl,因此仅适用于http。

www.domain.com/admin/order/remote_request?
www.domain.com/admin/order/print/131756

我当前的htacess文件是广告

<IfModule mod_rewrite.c>
    <IfModule mod_negotiation.c>
        Options -MultiViews
    </IfModule>

    RewriteEngine On

    # Redirect Trailing Slashes If Not A Folder...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule ^(.*)/$ /$1 [L,R=301]        

    # Redirect non www request to www
    RewriteCond %{HTTP_HOST} !^www\.
    RewriteRule ^(.*)$ http://www.%{HTTP_HOST}/$1 [R=301,L]        

    # Redirect http request to https
    RewriteCond %{HTTPS} off    
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

    # Handle Front Controller...
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteRule ^ index.php [L]
</IfModule>

1 个答案:

答案 0 :(得分:1)

尝试:

    # Redirect http request to https
RewriteCond %{THE_REQUEST} !/admin/order/remote_request\? [NC]
RewriteCond %{THE_REQUEST} !/admin/order/print/131756 [NC]

    RewriteCond %{HTTPS} off    
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]