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
-
Dodgy links across top ranking sites in a certain industry - Could this be negative link building?
Hi, I've noticed repeated low value / high spam backlinks directing to a site that I manage, and despite disavowing, new links showing similar anchor text keep appearing. See sample in the table below: <colgroup><col width="514"> <col width="407"> <col width="364"></colgroup>
White Hat / Black Hat SEO | | Alexanders
| biz.mfso.info/files/images/vertical-blinds-for-bifold-doors.html | | Get free high quality HD wallpapers vertical blinds for bifold doors |
| nmr.mfso.info/files/images/mould-on-vertical-blinds.html | | Get free high quality HD wallpapers mould on vertical blinds |
| nmr.mfso.info/files/images/install-vertical-blinds.html | | Get free high quality HD wallpapers install vertical blinds |
| nmr.mfso.info/files/images/cutting-vertical-blinds.html | | Get free high quality HD wallpapers cutting vertical blinds |
| rre.uere.info/files/images/high-quality-vertical-blinds.html | HD wallpapers high quality vertical blinds rre.uere.info | Get free high quality HD wallpapers high quality vertical blinds |
| dig.uere.info/files/images/mould-on-vertical-blinds.html | HD wallpapers mould on vertical blinds dig.uere.info | Get free high quality HD wallpapers mould on vertical blinds |
| dig.uere.info/files/images/mould-on-vertical-blinds.html | HD wallpapers mould on vertical blinds dig.uere.info | Get free high quality HD wallpapers mould on vertical blinds |
| hja.uere.info/files/images/cost-vertical-blinds.html | HD wallpapers cost vertical blinds hja.uere.info | Get free high quality HD wallpapers cost vertical blinds | I also looked across 5 high ranking sites in the same industry and noticed they too have these 'dodgy' links in their backlink profiles. Could this be negative link building? If so, does anyone know a way to trace it or get it stop?0 -
Seeking Site Feedback
Hello everyone! Hope you are all doing well. Long story short, I'm currently in the 30-day trial period for Moz Pro and I'm taking advantage of running a campaign for my (currently) one-man SEO/Digital Marketing company. Recently built my site using Divi. Filled out all the SEO information through the Yoast SEO plugin, tied Google Analytics, etc... Seeking feedback on the visuals of the website and whether you have any feedback on link-building in order to bring in more traffic to the site. http://fourpeaksseo.com Thanks!
White Hat / Black Hat SEO | | Four-Peaks-SEO0 -
Are bloggs published on blog platforms and on our own site be considered duplicate content?
Hi, SEO wizards! My company has a company blog on Medium (https://blog.scratchmm.com/). Recently, we decided to move it to our own site to drive more traffic to our domain (https://scratchmm.com/blog/). We re-published all Medium blogs to our own website. If we keep the Medium blog posts, will this be considered duplicate content and will our website rankings we affected in any way? Thank you!
White Hat / Black Hat SEO | | Scratch_MM0 -
Scraped site, hijacked searches for business name.
Hello, I have a site that was scraped (possibly by a competitor's seo company), who then built links to the duplicate site. When people do a search for the name of the business the scraped site is all that comes up along with the usual third-party sites. They seem to take the site down and put it back up every couple of weeks to maintain the rankings in Google. Has anyone ever dealt with something like this? Any advice or recommendations would be appreciated. Search: LIC Dental Associates Scraped site: old-farmshow.net Legit site: licdentalassociates.com Thanks, Emery
White Hat / Black Hat SEO | | tntdental1 -
Site Footer Links Used for Keyword Spam
I was on the phone with a proposed web relaunch firm for one of my clients listening to them talk about their deep SEO knowledge. I cannot believe that this wouldn’t be considered black-hat or at least very Spammy in which case a client could be in trouble. On this vendor’s site I notice that they stack the footer site map with about 50 links that are basically keywords they are trying to rank for. But here’s the kicker shown by way of example from one of the themes in the footer: 9 footer links:
White Hat / Black Hat SEO | | RosemaryB
Top PR Firms
Best PR Firms
Leading PR Firms
CyberSecurity PR Firms
Cyber Security PR Firms
Technology PR Firms
PR Firm
Government PR Firms
Public Sector PR Firms Each link goes to a unique URL that is basically a knock-off of the homepage with a few words or at the most one sentences swapped out to include this footer link keyword phrase, sometimes there is a different title attribute but generally they are a close match to each other. The canonical for each page links back to itself. I simply can’t believe Google doesn’t consider this Spammy. Interested in your view.
Rosemary0 -
How do I get more video reviews on a new site?
Hi, I'm working on a site that has video reviews of various places. It's general information/experience that most people possess and production-wise they are selfies. These videos are then transcribed and, voila... searchable content. My problem is this... how do I get large numbers of people to go to the trouble to make a 2 minute selfie? I thought about HARO, since one could work in a plug for something, but they have a site traffic threshold that this new site isn't at. Any and all ideas on how to efficiently generate this content for a new site with very little traffic would be appreciated. Thanks!
White Hat / Black Hat SEO | | 945010 -
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 -
Switching existing website to a Wordpress Site and afraid of losing top spot
I am going to be switching my current site from a standard html site to a wordpress site. I'm kind of paranoid of losing my top spot for the keyterms. If I keep the content the same, and keep the same amount of image alt tags, the same anchor text etc, nothing should change right? Grateful for any advice. Thanks Will
White Hat / Black Hat SEO | | willie790