Mobile app version of vmapp.org
Login or Join
Murray155

: Is my .htaccess settings hurting SEO? I have a site that I have redirecting to HTTPS. I do this to leverage wildcard SSL for my password protected pages. Everything seems to work fine with

@Murray155

Posted in: #301Redirect #Htaccess #Https #Seo

I have a site that I have redirecting to HTTPS. I do this to leverage wildcard SSL for my password protected pages. Everything seems to work fine with testing. For example, whether you type in HTTP or www, you always get redirected to the SSL HTTPS...

That said, I have about 200-300 external backlinks -- many high quality, yet Google Webmaster (along with SEOMoz), shows I have just 4... Huh? I'm embarrassed to say I just discovered this. This has led me to hypothesize that maybe my settings in .htaccess is messed up, so Google isn't recognizing a link because it's recorded on another site as HTTP, instead of HTTPS. Maybe? At any rate, here is my simple .htaccess setting for 301 www to HTTP, and from HTTP to HTTPS.

RewriteCond %{SERVER_PORT} !443
RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]
RewriteRule ^(.*)$ example.com/ [L,R=301]

RewriteCond %{SERVER_PORT} 443
RewriteCond %{HTTP_HOST} ^www.example.com$ [NC]
RewriteRule ^(.*)$ example.com/ [L,R=301]


Like I said, everything works fine for redirect over HTTPS, so I'd rather not screw up what works. On the other hand something is very wrong with Google finding all my back links, so I need to fix something... I'm just wondering that maybe Google isn't picking up a my backlinks from other websites recording me as HTTP because I'm at HTTPS. Maybe Google doesn't care and it's some other issue. Am I barking up the right tree? If so any quick fixes?

10.01% popularity Vote Up Vote Down


Login to follow query

More posts by @Murray155

1 Comments

Sorted by latest first Latest Oldest Best

 

@Pope3001725

Sorry about logging in as a different user. Still new here. I didn't think this site was affiliated to the other site. Thanks for adding a loop between the two sites. How about an answer for people. These 301s seem to have many ways of solving this and it can get confusing. I had a special use-case trying to do two things in one shot >> redirect all www.example.com & example.com over to example.com.
This worked like a charm for me. These two conditions play nicely.

RewriteCond %{HTTPS} off
RewriteCond %{HTTP_HOST} ^www.(.*)$ [NC]
RewriteRule ^(.*)$ %1/ [R=301,L]

RewriteCond %{HTTPS} on
RewriteCond %{HTTP_HOST} ^www.(.*)$ [NC]
RewriteRule ^(.*)$ %1/ [R=301,L]

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme