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
-
Duplication content management across a subdir based multisite where subsites are projects of the main site and naturally adopt some ideas and goals from it
Hi, I have the following problem and would like which would be the best solution for it: I have a site codex21.gal that is actually part of a subdirectories based multisite (galike.net). It has a domain mapping setup, but it is hosted on a folder of galike.net multisite (galike.net/codex21). My main site (galike.net) works as a frame-brand for a series of projects aimed to promote the cultural & natural heritage of a region in NW Spain through creative projects focused on the entertainment, tourism and educational areas. The projects themselves will be a concretion (put into practice) of the general views of the brand, that acts more like a company brand. CodeX21 is one of those projects, it has its own logo, etc, and is actually like a child brand, yet more focused on a particular theme. I don't want to hide that it makes part of the GALIKE brand (in fact, I am planning to add the Galike logo to it, and a link to the main site on the menu). I will be making other projects, each of them with their own brand, hosted in subsites (subfolders) of galike.net multisites. Not all of them might have their own TLD mapped, some could simply be www.galike.net/projectname. The project codex21.gal subsite might become galike.net/codex21 if it would be better for SEO. Now, the problem is that my subsite codex21.gal re-states some principles, concepts and goals that have been defined (in other words) in the main site. Thus, there are some ideas (such as my particular vision on the possibilities of sustainable exploitation of that heritage, concepts I have developed myself as "narrative tourism" "geographical map as a non lineal story" and so on) that need to be present here and there on the subsite, since it is also philosophy of the project. BUT it seems that Google can penalise overlapping content in subdirectories based multisites, since they can seem a collection of doorways to access the same product (*) I have considered the possibility to substitute those overlapping ideas with links to the main page of the site, thought it seems unnatural from the user point of view to be brought off the page to read a piece of info that actually makes part of the project description (every other child project of Galike might have the same problem). I have considered also taking the subsite codex21 out of the network and host it as a single site in other server, but the problem of duplicated content might persist, and anyway, I should link it to my brand Galike somewhere, because that's kind of the "production house" of it. So which would be the best (white hat) strategy, from a SEO point of view, to arrange this brand-project philosophy overlapping? (*) “All the same IP address — that’s really not a problem for us. It’s really common for sites to be on the same IP address. That’s kind of the way the internet works. A lot of CDNs (content delivery networks) use the same IP address as well for different sites, and that’s also perfectly fine. I think the bigger issue that he might be running into is that all these sites are very similar. So, from our point of view, our algorithms might look at that and say “this is kind of a collection of doorway sites” — in that essentially they’re being funnelled toward the same product. The content on the sites is probably very similar. Then, from our point of view, what might happen is we will say we’ll pick one of these pages and index that and show that in the search results. That might be one variation that we could look at. In practice that wouldn’t be so problematic because one of these sites would be showing up in the search results. On the other hand, our algorithm might also be looking at this and saying this is clearly someone trying to overdo things with a collection of doorway sites and we’ll demote all of them. So what I recommend doing here is really trying to take a step back and focus on fewer sites and making those really strong, and really good and unique. So that they have unique content, unique products that they’re selling. So then you don’t have this collection of a lot of different sites that are essentially doing the same thing.” (John Mueller, Senior Webmaster Trend Analyst at Google. https://www.youtube.com/watch?time_continue=1&v=kQIyk-2-wRg&feature=emb_logo)
White Hat / Black Hat SEO | | PabloCulebras0 -
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 -
Am I over "Optimising My Site" or following "Best Practice"
Hi We're developing our site an wanted to ask if we are "over optimising" or following best practice. Maybe you have some recommendations. I've provided 4 examples below. Eventually we'll use Moz on page grader but as a new start up, I'd appreciate your help. Thank you, Faye. 1. URL: http://www.thewoodgalleries.co.uk/engineered-wood/browns/cipressa/ PAGE TITLE: Cipressa | Engineered Brown Wood | The Wood Galleries H1: Cipressa – Engineered Brown Wood KEYWORD: Engineered Brown Wood META: Buy Cipressa Brown Engineered Wood, available at The Wood Galleries, London. Provides an Exceptional Foundation for Elegant Décor & Extravagant Furnishings. IMAGE TAG: Brown Engineered Flooring KEYWORD IN BODY CONTENT: YES (1) 2. URL: http://www.thewoodgalleries.co.uk/engineered-wood/beiges/mauro/ H1: Mauro | Beige Engineered Wood | The Wood Galleries PAGE TITLE: Mauro – Beige Engineered Wood KEYWORD: Beige Engineered Wood META: Buy Mauro Beige Engineered Wood Flooring, available at The Wood Galleries, London. Designed to deliver Rich, Dark Undertones with Light hues of Muted Brown. IMG TAG: Beige Wood Flooring KEYWORD IN BODY CONTENT: YES (2) **3. URL: http://www.thewoodgalleries.co.uk/engineered-wood/beiges/vela-oak/ ** H1: Vela – Beige Engineered Oak PAGE TITLE: Vela | Beige Engineered Oak | The Wood Galleries KEYWORD: Beige Engineered Oak META: Buy Vela Beige Engineered Oak Wood, available at The Wood Galleries, London. Crafted from the most widely respected hardwoods in the world. IMG TAG: Engineered Oak Flooring KEYWORD IN BODY CONTENT: YES (1) 4. URL: http://www.thewoodgalleries.co.uk/engineered-wood/darks-blacks/ciro-rustic/ H1: Ciro – Engineered Rustic Wood PAGE TITLE: Ciro | Engineered Rustic Wood | The Wood Galleries KEYWORD: Engineered Rustic Wood META: Buy Ciro Engineered Rustic Wood, at The Wood Galleries, London. Its stylishly classic oak look exudes a sense of luxury that is simply undeniable. IMG TAG: Dark Wood Flooring, The Wood Galleries KEY WORD IN BODY CONTENT: YES (2)
White Hat / Black Hat SEO | | Faye2340 -
HTTPS/SSL and Backlinks
I am planning on moving my site to HTTPS. I brought an expired domain and wondering if moving to HTTPS will affects the previous backlinks? Will I need to do a redirect? Will I lose any link juice? Thanks
White Hat / Black Hat SEO | | wspence150 -
How will Google deal with the crosslinks for my multiple domain site
Hi, I can't find any good answer to this question so I thought, why not ask Moz.com ;-)! I have a site, let's call it webshop.xx For a few languages/markets, Deutsch, Dutch & Belgian, English, French. I use a different TLD with a different IP for each of these languages, so I'll end up with: webshop.de, webshop.nl, webshop.be, webshop.co.uk, webshop.com & webshop.fr They all link to eachother and every subpage that is translated from the other site gets a link as well from the other languages, so: webshop.com/stuff links to webshop.de/stuff My main website, webshop.com gets links from every other of these domain which Open Site Explorer as well as Majestic SEO sees as an external link. (this is happening) My question. How will Google deal in the long-run with the crosslinks coming from these domains? some guesses I made: I get full external links juice (content is translated so unique?) I get a bit of the juice of an external link They are actually seen as internal links I'll get a penalty Thanks in advance guys!!!
White Hat / Black Hat SEO | | pimarketing0 -
More than one site in same industry
A client wants to have 3 sites in the same industry with a lot of overlapping keywords. Is that white hat? Will Google mind?
White Hat / Black Hat SEO | | BobGW0 -
Thinking of redirecting *all* mobile traffic to another site (via an advertiser) - safe to do?
Hi, I am thinking of redirecting all mobile (iphone, cell phone, etc) to an advertiser (so completely different content than my site). Is there any risk of getting banned from google (etc) for doing this? (this is for an adult site)
White Hat / Black Hat SEO | | dmn020