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.
Got a burning SEO question?
Subscribe to Moz Pro to gain full access to Q&A, answer questions, and ask your own.
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
-
Why is this site ranked #1 in Google with such a low DA (is DA not important anymore?)
Hi Guys, Would you mind helping me with the below please? I would like to get your view on it and why Google ranks a really new domain name #1 with super low domain authority? Or is Domain Authority useless now in Google? It seems like from the last update that John Mueller said that they do not use Domain Authority so is Moz Domain Authority tool not to take seriously or am I missing something? There is a new rehab in Thailand called https://thebeachrehab.com/ (Domain authority 13)It's ranked #1 in Google.co.th for these phrases: drug rehab thailand but also for addiction rehab thailand. So when checking the backlink profile it got merely 21 backlinks from really low DA sites (and some of those are really spammy or not related). Now there are lots of sites in this industry here which have a lot higher domain authority and have been around for years. The beach rehab is maybe only like 6 months old. Here are three domains which have been around for many years and have much higher DA and also more relevant content. These are just 3 samples of many others... <cite class="iUh30">https://www.thecabinchiangmai.com (Domain Authority 52)</cite>https://www.hope-rehab-center-thailand.com/ (Domain Authority 40)https://www.dararehab.com (Domain Authority 32) These three sites got lots of high DA backlinks (DA 90++) from strong media links like time.com, theguardian.com, telegraph.co.uk etc. (especially thecabinchiangmai.com) but the other 2 got lots of solid backlinks from really high DA sites. So when looking at the content, thebeachrehab.com has less content as well. Can anyone have a look and let me know your thoughts why Google picks a brand new site, with DA 13 and little content in the top compared to competition? I do not see the logic in this? Cheers
White Hat / Black Hat SEO | | igniterman75
John0 -
We have a site with a lot of international traffic, can we split the site some way?
Hello, We have a series of sites and one, in particular, has around 75,000 (20%) monthly users from the USA, but we don't currently offer them anything as our site is aimed at the UK market. The site is a .com and though we own the .co.uk the .com is the primary domain. We have had a lot of success moving other sites to have the .co.uk as the primary domain for UK traffic. However, in this case, we want to keep both the UK traffic and the US traffic and if we split it into two sites, only one can win right? What could do? It would be cool to have a US version of our site but without affecting traffic too much. On the other sites, we simply did 301 redirects from the .com page to the corresponding .co.uk page. Any ideas?
White Hat / Black Hat SEO | | AllAboutGroup0 -
Site build in the 80% of canonical URLs - What is the impact on visibility?
Hey Everyone, I represent international wall decorations store where customer can freely choose a pattern to be printed on a given material among a few milions of patterns. Due to extreme large number of potential URL combinations we struggle with too many URL adressess for a months now (search console notifications). So we finally decided to reduce amount of products with canonical tag. Basing on users behavior, our business needs and monthly search volume data we selected 8 most representative out of 40 product categories and made them canonical toward the rest. For example: If we chose 'Canvas prints' as our main product category, then every 'Framed canvas' product URL points rel=canonical tag toward its equivalent URL within 'Canvas prints' category. We applied the same logic to other categories (so "Vinyl wall mural - Wild horses running" URL points rel=canonical tag to "Wall mural - Wild horses running" URL, etc). In terms of Googlebot interpretation, there are really tiny differences between those Product URLs, so merging them with rel=canonical seems like a valid use. But we need to keep those canonicalised URLs for users needs, so we can`t remove them from a store as well as noindex does not seem like an good option. However we`re concerned about our SEO visibility - if we make those changes, our site will consist of ~80% canonical URLs (47,5/60 millions). Regarding your experience, do you have advices how should we handle that issue? Regards
White Hat / Black Hat SEO | | _JediMindBender
JMB0 -
Site dropping in rank even through there are more backlinks being added
Hello, One of my client's sites is ranking lower than he should. This happened when we took off backlinks (20 little blogs, several site-wide paid links. It really dropped the site, but it had to be done. Since then we've increased his # of root domains by 10% through white hat link building in his non-competitive niche, and rankings are still poor. I know that's not much in the way of added backlink value, but we're working on it. My question is, how have the recent (and coming) updates possibly effected us. We want to take the remaining problem areas off right away, but another drop in traffic is not a good idea. Even though the blogs (see below) have no backlinks of themselves, they cause drops when taken off) He still has -20 little blog backlinks w/ a quarter of them being exact match anchor text.
White Hat / Black Hat SEO | | BobGW
-1 sitewide paid link - an image, exact match alt tag anchor text
-1 non-site-wide paid links that is an image near the footer, exact match alt tag anchor text.
-3 links on a domain, this one looks fairly editorial, but there are a bunch of paid links on that page. Changing to non-exact-match anchor text
-2 links on two domains that look completely editorial with no other paid links on that page. non-exact-match anchor text -70 backlinks total with about 1/3 being problematic. How does this site look in regards to updates and when to take links off without tanking our site even more? Thanks.0 -
Tags on WordPress Sites, Good or bad?
My main concern is about the entire tags strategy. The whole concept has really been first seen by myself on WordPress which seems to be bringing positive results to these sites and now there are even plugins that auto generate tags. Can someone detail more about the pros and cons of tags? I was under the impression that google does not want 1000's of pages auto generated just because of a simple tag keyword, and then show relevant content to that specific tag. Usually these are just like search results pages... how are tag pages beneficial? Is there something going on behind the scenes with wordpress tags that actually bring benefits to these wp blogs? Setting a custom coded tag feature on a custom site just seems to create numerous spammy pages. I understand these pages may be good from a user perspective, but what about from an SEO perspective and getting indexed and driving traffic... Indexed and driving traffic is my main concern here, so as a recap I'd like to understand the pros and cons about tags on wp vs custom coded sites, and the correct way to set these up for SEO purposes.
White Hat / Black Hat SEO | | WebServiceConsulting.com1 -
Retail Site and Internal Linking Best Practices
I am in the process of recreating my company's website and, in addition to the normal retail pages, we are adding a "learn" section with user manuals, reviews, manufacturer info, etc. etc. It's going to be a lot of content and there will be linking to these "learn" pages from both products and other "learn" pages. I read on a SEOmoz blog post that too much internal linking with optimized anchor text can trigger down-rankings from Google as a penalty. Well, we're talking about having 6-8 links to "learn" pages from product pages and interlinking many times within the "learn" pages like Wikipedia does. And I figured they would all have optimized text because I think that is usually best for the end user (I personally like to know that I am clicking on "A Review of the Samsung XRK1234" rather than just "A Review of Televisions"). What is best practice for this? Is there a suggested limit to the number of links or how many of them should have optimized text for a retail site with thousands of products? Any help is greatly appreciated!
White Hat / Black Hat SEO | | Marketing.SCG0 -
Auto-link inside your own site to the same domain is white-hat?
Hi, I am using a plugin in wordpress that make auto link for some certain keywords in my site suppose: My site is example.com My important keyword is: sample and across the domain example.com through out the content if there is the word: sample it is linked automatically to example.com I like your opinion about this practice, if it may carry any kind of punishment by SEs? Thanks.
White Hat / Black Hat SEO | | Pooria0 -
Will the links coming from an article in certain BLOG / NEWS SITE become a GOOD BackLink?
Such as, if i wrote a ymoz, and suddenly the articles is accepted, will the link to our site coming out of that Article Post increased our SEO Standing? Another example would be http://active.tutsplus.com , yesterday i have successfully pitched a tutorial idea, and they told me to write it so that they can published it , and they also promised that i will be able to put my site link (dofollow) ... But will these link be a Good BackLink that will increase our site's SEO Standing? The last one is exactly the same link , but this time coming from a News Site , such as http://teknologi.kompasiana.com/internet/2011/06/09/website-full-flash-dengan-inovasi-hebat-karya-indonesia/ , in this article (kompasiana is a very wellknown site news in Indonesia, in fact KOMPAS is the biggest newspaper firm in Indonesia) , our site is being featured , there is a link coming out of that article (DOFOLLOW), but will that link make our site much more SEO Friendly? Again please enlighten me 🙂
White Hat / Black Hat SEO | | IKT0