Redirect to https, unable to exclude subdomain

Hi All,

I have recently redirected all duplicate pages as well as my domain to https! All good, points to the same domain.
My problem is the subdomain (which is my blog) also gets redirect to https://…
I have tried a million ways to exclud it, but I haven’t managed to be successful. Below is my last try.
Really Stuck, can you help?

Here is my htaccess code:

RewriteEngine On
RewriteBase /

(quite a few of the redirects below)
Redirect 301 /

RewriteOptions inherit

RewriteEngine on

Order deny,allow
RewriteEngine on
RewriteCond %{HTTP_USER_AGENT} Wget [OR]
RewriteCond %{HTTP_USER_AGENT} CherryPickerSE [OR]
RewriteCond %{HTTP_USER_AGENT} CherryPickerElite [OR]
RewriteCond %{HTTP_USER_AGENT} EmailCollector [OR]
RewriteCond %{HTTP_USER_AGENT} EmailSiphon [OR]
RewriteCond %{HTTP_USER_AGENT} EmailWolf [OR]
RewriteCond %{HTTP_USER_AGENT} ExtractorPro
RewriteRule ^.$ deny.html [L]
RewriteEngine on
Options +FollowSymLinks
RewriteCond %{THE_REQUEST} ^.
/index.html
RewriteCond %{THE_REQUEST} !^Blog.westhavenretreat.com$
RewriteRule ^(.)index.html$ https://www.westhavenretreat.com/$1 [R=301,L]
RewriteEngine on
RewriteCond %{HTTP_HOST} ^www.(.
)
RewriteCond %{HTTP_HOST} !^Blog.wsample.com$ [NC]
RewriteRule ^.$ https://%1/$1 [R=301,L]
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTPS} !Blog.wsample.com$
RewriteRule ^(.
)$ https://www.wsample.com/$1 [L,R=301]

MV,

Just looking at your mod_rewrite code tells me that you’ve kludged together snippets from various sources without understanding what they do (nor how to order them). Therefore, my first advice is to have a read of the code generation part of my mod_rewrite tutorial at http://dk.co.nz/seo.

Since you’ve combined mod_rewrite and mod_alias code, know that mod_alias (redirect) and the Options +FollowSymLinks are part of the Apache core code and those directives will always be acted upon before anything from mod_rewrite. Additionally, both statements should be in the httpd.conf which make them redundant in .htaccess.

Then, RewriteEngine on is mod_rewrite’s “turn off comment mode” code. Seeing that six times (without corresponding RewriteEngine off - the “enter comment mode” code) is absurd.

WHAT is mod_rewrite supposed to inherit (assuming, of course, that this is in the DocumentRoot)?

While thinking DocumentRoot, WHY use the RewriteBase directive? It can only confuse you.

General rule of thumb: Make specific situational redirections first and progress to the most general. That will ensure that you at least THINK about making exclusions for your specific redirections with RewriteCond statements in the more general RewriteRule blocks.

Finally, subdomains are normally created with direct links to a subdirectory of the main domain. Because that bypasses the .htaccess for the main domain, the redirections there will not affect the subdomain requests.

There are other rather obvious errors in your code but you need to correct these major issues before getting to them.

Regards,

DK

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.