How do I keep only 1 page to http when I have forced a sitewide https?

November 20, 2015 614 views
Apache DNS

On my website, I have one page that loads content in iframe form other sources and hence cannot have an http connection. I have an SSL installed and have a site wide https forced on all urls. I am running Symfony 1.4 application and the rewrites and redirects are various level are:

VirtualHost Setting:

<VirtualHost *:80>
   Redirect permanent /
<VirtualHost *:443>

  SSLEngine on
  SSLCertificateFile /path/to/ssl/myserver.crt
  SSLCertificateKeyFile /path/to/ssl/myserver.key
  SSLCertificateChainFile /path/to/ssl/
  DocumentRoot /var/www/myserver/web
  DirectoryIndex index.php
  <Directory /var/www/myserver>
    Options Indexes FollowSymLinks MultiViews
    AllowOverride All
    Order allow,deny
    allow from all
    Require all granted
  <Directory "/var/www/hubhopper_1.0/web/images">
    LimitRequestBody 2147483647



Options +FollowSymLinks +ExecCGI

<IfModule mod_rewrite.c>
  RewriteEngine On
  RewriteBase /

  RewriteCond %{HTTP_HOST} ^www\.(.*)$ [NC] 
  RewriteRule ^(.*)$ http://%1/$1 [R=301,L]  
  RewriteCond %{HTTPS} off
  RewriteRule (.*) https://%{HTTPHOST}%{REQUESTURI} 

  RewriteRule ^$ index.html [QSA]
  RewriteRule ^([^.]+)$ $1.html [QSA]
  RewriteCond %{REQUEST_FILENAME} !-f

  RewriteRule ^(.*)$ index.php [QSA,L]

I want that only this page <url>/link-view/<id>, should be on http. I tried modifying the .htaccess by adding these lines:

RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} 
RewriteCond %{HTTP_HOST} ^(www\.)?(.*)$ [NC]
RewriteRule ^(.*)$ https://%2/$1 [R=301,L,QSA]

RewriteCond %{HTTPS} on
RewriteCond %{REQUEST_URI} lin-view
RewriteCond %{HTTP_HOST} ^(www\.)?(.*)$ [NC]
RewriteRule ^(.*)$ http://www.%2/$1 [R=301,L,QSA]

But it does not work and shows 'too many redirects' on the page. How do I achieve that?

Be the first one to answer this question.