Title: apache config, htaccess for mixed http, https
Last modified: September 1, 2016

---

# apache config, htaccess for mixed http, https

 *  [example.com](https://wordpress.org/support/users/vineettalwar3/)
 * (@vineettalwar3)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/apache-config-htaccess-for-mixed-http-https/)
 * Hi,
    I am currently trying to setup following. Following two are separate WordPress
   4.5.3 installations– a) [https://example.com](https://example.com) -> on https
   b) [http://site1.example.com](http://site1.example.com) -> on http
 * I am trying to make [https://example.com](https://example.com) to be multisite
   
   and run network site [http://multisite1.example.com](http://multisite1.example.com)
   and [http://multisite2.example.com](http://multisite2.example.com) (networks 
   sites to be http)
 * **Note:** There is ssl in the root installation. Not looking forward to make 
   subdomains https..
 * **Requirement:** On one linux server/ IP address.
    2 Separate wordpress installations,
   and one of them multisite. Only root domain installation https and subdomains
   http installation and second subdomain install http as well. I am facing problem
   in configuring it. **Problem:** Multisite network site [http://multisite1.example.com](http://multisite1.example.com)
   is redirecting to [https://example.com](https://example.com) I doubt the issue
   is somewhere within htaccess rule. but not able to point that out. Looking forward
   for a guidance on where I am doing wrong.
 * Following is the current apache config ->
    **a) for [https://example.com](https://example.com)**
 *     ```
       <VirtualHost *:80>
         ServerName www.example.com
         ServerAdmin admin@example.com
   
       Redirect 301 / https://example.com/
       </VirtualHost>
   
       <VirtualHost *:80>
        ServerName example.com
        ServerAlias multisite1.example.com multisite2.example.com
        ServerAdmin admin@example.com
        DocumentRoot /var/www/html/example.com/docroot
   
         <Directory /var/www/html/example.com/docroot>
           Options Indexes FollowSymLinks MultiViews
           AllowOverride All
           Order allow,deny
           allow from all
         </Directory>
   
         ErrorLog /var/log/httpd/example.error.log
         LogLevel warn
        CustomLog /var/log/httpd/example.access.log combined
       </VirtualHost>
       ```
   
 * **Virtual host for [http://site1.example.com](http://site1.example.com)**
 *     ```
       <VirtualHost *:80>
         ServerName www.site1.example.com
         ServerAdmin admin@example.com
   
       Redirect 301 / http://site1.example.com/
       </VirtualHost>
       <VirtualHost *:80>
         ServerName site1.example.com
         ServerAdmin admin@example.com
         DocumentRoot /var/www/html/site1.example.com/docroot
         <Directory /var/www/html/site1.example.com/docroot>
         Options Indexes FollowSymLinks MultiViews
           AllowOverride All
           Order allow,deny
           allow from all
         </Directory>
   
         ErrorLog /var/log/httpd/site1.example.error.log
         LogLevel warn
        CustomLog /var/log/httpd/site1.example.access.log combined
       </VirtualHost>
       ```
   
 * **Following is htaccess->**
 *     ```
       #Begin https#
       <IfModule mod_rewrite.c>
       RewriteEngine On
       RewriteCond %{SERVER_PORT} 80
       RewriteRule ^(.*)$ https://example.com/$1 [R,L]
       </IfModule>
       #End https#
       #multisite setup begin
       <IfModule mod_rewrite.c>
       RewriteEngine On
       RewriteBase /
       RewriteRule ^index\.php$ - [L]
   
       # add a trailing slash to /wp-admin
       RewriteRule ^wp-admin$ wp-admin/ [R=301,L]
   
       RewriteCond %{REQUEST_FILENAME} -f [OR]
       RewriteCond %{REQUEST_FILENAME} -d
       RewriteRule ^ - [L]
       RewriteRule ^(wp-(content|admin|includes).*) $1 [L]
       RewriteRule ^(.*\.php)$ $1 [L]
       RewriteRule . index.php [L]
       </IfModule>
       # multisite setup end#
   
       Options -Indexes
       Header unset Pragma
       FileETag None
       Header unset ETag
       # EXPIRES CACHING ##
       <IfModule mod_expires.c>
       ExpiresActive On
       ExpiresByType image/jpg "access 1 year"
       ExpiresByType image/jpeg "access 1 year"
       ExpiresByType image/gif "access 1 year"
       ExpiresByType image/png "access 1 year"
       ExpiresByType text/css "access 1 month"
       ExpiresByType text/html "access 1 month"
       ExpiresByType application/pdf "access 1 month"
       ExpiresByType text/x-javascript "access 1 month"
       ExpiresByType application/x-shockwave-flash "access 1 month"
       ExpiresByType image/x-icon "access 1 year"
       ExpiresByType audio/mpeg3 "access 1 year"
       ExpiresDefault "access 1 month"
       </IfModule>
       ## EXPIRES CACHING ##
       <FilesMatch "\\.(js|css|html|htm|php|xml)$">
       SetOutputFilter DEFLATE
       </FilesMatch>
       <IfModule mod_headers.c>
         <FilesMatch ".(js|css|xml|gz)$">
           Header append Vary: Accept-Encoding
         </FilesMatch>
       </IfModule>
       ```
   
 * **Following are the wp-config.php constants ->**
 *     ```
       define('FORCE_SSL_ADMIN', true);
       $_SERVER['SERVER_PORT'] = 443;
       /* Multisite */
       define( 'WP_ALLOW_MULTISITE', true );
       define('MULTISITE', true);
       define('SUBDOMAIN_INSTALL', true);
       define('DOMAIN_CURRENT_SITE', 'example.com');
       define('PATH_CURRENT_SITE', '/');
       define('SITE_ID_CURRENT_SITE', 1);
       define('BLOG_ID_CURRENT_SITE', 1);
       define( 'SUNRISE', 'on' );
       ```
   

Viewing 3 replies - 1 through 3 (of 3 total)

 *  Thread Starter [example.com](https://wordpress.org/support/users/vineettalwar3/)
 * (@vineettalwar3)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/apache-config-htaccess-for-mixed-http-https/#post-7521554)
 * **Update:**
    a) **Solved:** [http://multisite1.example.com](http://multisite1.example.com)
   by updating following things-> **i) Removed following lines .htaccess**
 *     ```
       <IfModule mod_rewrite.c>
       RewriteEngine On
       RewriteCond %{SERVER_PORT} 80
       RewriteRule ^(.*)$ https://example.com/$1 [R,L]
       </IfModule>
       ```
   
 * **ii) In wp-config.php removed
 *     ```
       define('FORCE_SSL_ADMIN', true);
       $_SERVER['SERVER_PORT'] = 443;
       ```
   
 * **iii) mu-plugin for upgrade network error**
    Added a mu-plugin at wp-content/
   mu-plugins _sslverify.php
 *     ```
       <?php
       add_filter('https_ssl_verify', '__return_false');
       add_filter('https_local_ssl_verify', '__return_false');
       ?>
       ```
   
 *  Thread Starter [example.com](https://wordpress.org/support/users/vineettalwar3/)
 * (@vineettalwar3)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/apache-config-htaccess-for-mixed-http-https/#post-7521555)
 * **Update:** Following error is
    b) **_Not Solved_**: From [https://example.com/wp-admin/network/sites.php](https://example.com/wp-admin/network/sites.php)
   when clicking on Dashboard under [http://multisite1.example.com](http://multisite1.example.com)
   it opens [https://multisite1.example.com/wp-admin](https://multisite1.example.com/wp-admin)
   instead of [http://multisite1.example.com/wp-admin](http://multisite1.example.com/wp-admin)
 * **Checked:** siteul and home is set to [http://multisite1.example.com](http://multisite1.example.com)
   for network site…
 * Anyone have idea to avoid this redirect
 *  Thread Starter [example.com](https://wordpress.org/support/users/vineettalwar3/)
 * (@vineettalwar3)
 * [9 years, 10 months ago](https://wordpress.org/support/topic/apache-config-htaccess-for-mixed-http-https/#post-7521563)
 * **Update:**
    Solution posted in [reply no.1](https://wordpress.org/support/topic/apache-config-htaccess-for-mixed-http-https?replies=4#post-8576873)
   part (i) have a problem, which is example.com would be opening without https 
   as well and not redirecting.
 * **Solution:** Add following lines to .htaccess
 *     ```
       <IfModule mod_rewrite.c>
       RewriteEngine On
       RewriteCond %{HTTP_HOST} ^firemudfm\.com$
       RewriteCond %{SERVER_PORT} 80
       RewriteRule ^(.*)$ https://firemudfm.com/$1 [R,L]
       </IfModule>
       ```
   

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘apache config, htaccess for mixed http, https’ is closed to new replies.

## Tags

 * [mulitisite](https://wordpress.org/support/topic-tag/mulitisite/)

 * In: [Networking WordPress](https://wordpress.org/support/forum/multisite/)
 * 3 replies
 * 1 participant
 * Last reply from: [example.com](https://wordpress.org/support/users/vineettalwar3/)
 * Last activity: [9 years, 10 months ago](https://wordpress.org/support/topic/apache-config-htaccess-for-mixed-http-https/#post-7521563)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
