ErrorDocument 404 http://homeownersinsurance.com/404.php Options +FollowSymlinks RewriteEngine on RewriteBase / RewriteCond %{HTTP_HOST} ^([^.]+\.)homeownersinsurance.com$ RewriteRule ^(.+)$ - [env=captured_host:%1] RewriteCond %{HTTP_HOST} ^www\.homeownersinsurance\.com$ [NC] RewriteRule ^(.*)$ http://homeownersinsurance.com/$1 [R=301,L] RewriteCond %{REQUEST_URI} !(css|js|images|gif|ico|javascript|jpeg|jpg|includes|analytics.php|footer|footer.php) RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ ((/[^/]+)*)//+([^\ ]*)\ HTTP/ RewriteRule .* %1/%3 [R=301,L] RewriteCond %{HTTPS} on RewriteCond %{REQUEST_URI} !^/netquote/ RewriteCond %{REQUEST_URI} !^/quotes/ RewriteCond %{REQUEST_URI} !^/rd-quotes/ RewriteCond %{REQUEST_URI} !^/auto-insurance/quotes/ RewriteCond %{REQUEST_URI} !\.(js|css|png|jpg|jpeg|gif|ico|swf|flv)$ [NC] RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [L,R=301,QSA] RewriteCond %{HTTPS} on RewriteRule ^rd-quotes/(.*)$ https://%{ENV:captured_host}homeinsurance.com/rd-quotes/$1 [P] RewriteRule ^quotes/(.*)$ https://%{ENV:captured_host}homeinsurance.com/quotes/$1 [P] # The following is for *non* HTTPS RewriteCond %{HTTPS} off RewriteCond %{SERVER_NAME} !^(test|dev)\.homeownersinsurance\.com [NC] RewriteCond %{HTTP_HOST} !^homeownersinsurance\.com [NC] RewriteRule ^(.*)$ http://homeownersinsurance.com/$1 [L,R=301] #Rewrites for state,county,city pages RewriteRule ^(.*)/home-insurance-quotes.php /rewrites/state.php?id=$1 [NC] RewriteRule ^(.*)/(.*)-county-homeowners-insurance.php /rewrites/county.php?id=$1&id2=$2 [NC] RewriteRule ^(.*)/(.*)-home-insurance-quotes.php /rewrites/city.php?id=$1&id2=$2 [L] RewriteCond %{HTTPS} off RewriteRule ^quotes/(.*)$ https://%{ENV:captured_host}homeownersinsurance.com/quotes/$1 RewriteRule ^rd-quotes/(.*)$ https://%{ENV:captured_host}homeownersinsurance.com/rd-quotes/$1 RewriteCond %{REQUEST_URI} !^images/homeowners-insurance.jpg$ DirectoryIndex index.php RewriteCond %{THE_REQUEST} ^[A-Z]{3,9}\ /index\.php\ HTTP/ RewriteRule ^index\.php$ http://homeownersinsurance.com/ [R=301,L,QSA] RewriteRule ^quote_meyearbuilt.php$ http://%{ENV:captured_host}homeinsurance.com/quote_meyearbuilt.php? [P] AddType application/x-httpd-php .xml