Shailesh Daund
Shailesh Daund

Reputation: 180

How to remove ssl from specific url or page with htaccess

I am having a site with ssl. All pages from site are redirecting to https with www.

I want following urls to be non ssl, so it will work with http only.

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

My current htacess file is ad follows

<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>

Upvotes: 1

Views: 1777

Answers (1)

Amit Verma
Amit Verma

Reputation: 41219

Try :

    # 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]

Upvotes: 1

Related Questions