So I'm trying to create a mod_rewrite rule that will force only certain host/domains to rewrite everything from http:// to https://. I basically have an internal site and an external site. Internal site needs to be on port 80 or 443 whatever they originally went to the site as. However anything coming through on the external site on port 80 / http needs to be rewritten to 443 / https. Everyway I try I can't seem to get it to work. I can get it to rewrite everything to https regardless of host. Rewrite only the external site to https and any attempt to go to the internal address results in a apache error. I guess I cant figure out the way to RewriteCond include these addreses and exclude those. I've tried numerous suggestions and configs, i think this was my last non working setup: Options +FollowSymLinks RewriteEngine On RewriteCond %{SERVER_PORT} 80 RewriteCond %{HTTP_HOST} ^external\.mysite\.com RewriteCond %{HTTP_HOST} !^internalsite RewriteCond %{HTTP_HOST} !^internalsite\.mysite\.local RewriteRule ^(.*)$ https://external.mysite.com/$1 [R,L] Code (markup): I'm sure this is a pretty simple answer for anyone out there. I haven't had a whole lot of experiece with modrewrites other then simple redirects and redirecting everythnig for a site directory to https. Thanks!
What exactly do you mean by excluding internal sites? Try appending this: RewriteCond %{HTTPS} on RewriteCond %{HTTP_HOST} ^internalsite RewriteCond %{HTTP_HOST} ^internalsite\.mysite\.local RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI}