Forcing Entire site to HTTPS
-
We have a Wordpress site and hope to force everything to HTTPS.
- We change the site name (in wordpress settings) to https://mydomain.com
- In the htaccess code = http://moz.com/blog/htaccess-file-snippets-for-seos
-
Ensure we are using HTTPS version of the site.
- RewriteCond %{HTTPS} !on
- RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
but some blogs http://stackoverflow.com/questions/19168489/https-force-redirect-not-working-in-wordpress say
- RewriteCond %{HTTPS} off
- RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
Which one is right? and are we missing anything?
-
No it isn't. As I said -
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]This is saying that the condition is off - so non HTTPS URL calls then have the rewrite rule to switch to HTTPS.
-
Thanks for the reply Mick,
so if we are implementing HTTPS for the first time,
"RewriteCond %{HTTPS} on " is the right rule, right?
Thanks in advance for your time
-
It looks like you should be going for
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]This is saying that the condition is off - so non HTTPS URL calls then have the rewrite rule to switch to HTTPS
RewriteCond %{HTTPS} on - is looking for HTTPS URL calls, so the opposite.
Test it and see what happens. You can always restore your backup .htaccess if you hit problems. Please be aware that your server set-up may mean this doesn't work and you'll have to delve deeper.
Browse Questions
Explore more categories
-
Moz Tools
Chat with the community about the Moz tools.
-
SEO Tactics
Discuss the SEO process with fellow marketers
-
Community
Discuss industry events, jobs, and news!
-
Digital Marketing
Chat about tactics outside of SEO
-
Research & Trends
Dive into research and trends in the search industry.
-
Support
Connect on product support and feature requests.
Related Questions
-
Is new domian redirection to old domain make risk for my site ?
i have site with Da about 30 and i have many project on it if i register a domain for each project and after that redirect to my site is that bad for my site and my site seo ? for ex: my project is : mysite.com/helloword i register helloworld.com or domain like that helllo-world.com and redirctet to mysite.com/helloworld
White Hat / Black Hat SEO | | MidnightShop791 -
Site De-Indexed except for Homepage
Hi Mozzers,
White Hat / Black Hat SEO | | emerald
Our site has suddenly been de-indexed from Google and we don't know why. All pages are de-indexed in Google Webmaster Tools (except for the homepage and sitemap), starting after 7 September: Please see screenshot attached to show this: 7 Sept 2014 - 76 pages indexed in Google Webmaster Tools 28 Sept until current - 3-4 pages indexed in Google Webmaster Tools including homepage and sitemaps. Site is: (removed) As a result all rankings for child pages have also disappeared in Moz Pro Rankings Tracker. Only homepage is still indexed and ranking. It seems like a technical issue blocking the site. I checked for robots.txt, noindex, nofollow, canonical and site crawl for any 404 errors but can't find anything. The site is online and accessible. No warnings or errors appear in Google Webmaster Tools. Some recent issues were that we moved from Shared to Dedicated Server around 7 Sept (using same host and location). Prior to the move our preferred domain was www.domain.com WITH www. However during the move, they set our domain as domain.tld WITHOUT the www. Running a site:domain.tld vs site:www.domain.tld command now finds pages indexed under non-www version, but no longer as www. version. Could this be a cause of de-indexing? Yesterday we had our host reset the domain to use www. again and we resubmitted our sitemap, but there is no change yet to the indexing. What else could be wrong? Any suggestions appeciated. Thanks. hDmSHN9.gif0 -
Can I use content from an existing site that is not up anymore?
I want to take down a current website and create a new site or two (with new url, ip, server). Can I use the content from the deleted site on the new sites since I own it? How will Google see that?
White Hat / Black Hat SEO | | RoxBrock0 -
Seeking Top Notch Marketing Company with experience in growing sites post manual penalty
Does anyone know of a company who has direct experience with growing websites AFTER a manual link penalty has been lifted? Any referrals would be great!
White Hat / Black Hat SEO | | WebServiceConsulting.com0 -
Partial Match Penalty Site - Move Portion & Redirect To New Site
So I have a site that currently has a partial match penalty from google, I have been working to get it removed...Bad SEO basically my site was submitted to a bunch of bad blog networks..Hopefully it gets lifted soon as we remove and disavow links. That said I was planning on moving a portion of my site to a new site since its not really the focus of the site anymore however still pays the bills. I have also have been building it more of a network of sites..So If I do that and 301 redirect the pages I moved, will the penalty carry? On the current site I planned on using Rel no follow to any links that I may change in the header/menus etc.. Some of these pages I believe have the penalty while others dont. I really just dont want to screw anything else up more then it is? My biggest fear is that its perceived as a blackhat method or something like that? Any thoughts?
White Hat / Black Hat SEO | | dueces0 -
No Follows - Sister/manufacturer sites
What is the best practice nowadays for linking to sister sites? Should you do it, shouldn't you, and/or should you list them with no follows? What about the reverse - having them link to us. Is this bad for us in anyway? Should we have them no follow their link to us? We are a distributor so manufacturers link to us as well, should we have them no follow their links? Thanks!
White Hat / Black Hat SEO | | CHECOM0 -
Has my site been penalized by google
Hi all I have noticed a sudden drop in rankings for most of my keywords on kerryblu ,co,uk and was thinking the site may have been manually penalized by google. I have not received any notification of this in webmaster tools but can't think of any other reason for the loss of rankings. I have searched the web for info on this but can't find a definite answer. Is there any way of knowing for sure. At the time of the crash the only real change I made was adding google adsense to my blog. Could this be responsible. Thanks for looking.
White Hat / Black Hat SEO | | Dill0 -
My Site having a drop in traffic with eash passing month
Hi, I'm running a text message site mixsms.com from 2009. It was performing good till Oct 2012. In the end of Nov 2012 I noticed a drop in traffic and then with each passing month I'm getting 1500-2000 unique visitors drop. In Oct 2012 my daily unique visitors were 15000+ each day and now it is just having 2000 after Feb end. I've done several things to improve my site. I changes the template, removed all unnecessary html elements, changed seo structure (optimize with all modern seo techniques). Stop backlinking from Nov 2012 but instead of getting improvements I'm continuously having a drop in traffic. I'll highly appreciate your time if you look into site deeply to findout exact issues that are causing for this drop. I'm even ready to hire any seo consultant if he is pretty sure to get 100% results. Thanks in advance for your support
White Hat / Black Hat SEO | | intelmixx0