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 -> on https
b) https://site1.example.com -> on httpI am trying to make https://example.com to be multisite
and run network site https://multisite1.example.com and https://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 https://multisite1.example.com is redirecting to 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<VirtualHost *:80> ServerName www.example.com ServerAdmin [email protected] Redirect 301 / https://example.com/ </VirtualHost> <VirtualHost *:80> ServerName example.com ServerAlias multisite1.example.com multisite2.example.com ServerAdmin [email protected] 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 https://site1.example.com
<VirtualHost *:80> ServerName www.site1.example.com ServerAdmin [email protected] Redirect 301 / https://site1.example.com/ </VirtualHost> <VirtualHost *:80> ServerName site1.example.com ServerAdmin [email protected] 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' );
- The topic ‘apache config, htaccess for mixed http, https’ is closed to new replies.