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
-
Duplicate content - multiple sites hosted on same server with same IP address
We have three sites hosted on the same server with the same IP address. For SEO (to avoid duplicate content) reasons we need to redirect the IP address to the site - but there are three different sites. If we use the "rel canonical" code on the websites, these codes will be duplicates too, as the websites are mirrored versions of the sites with IP address, e.g. www.domainname.com/product-page and 23.34.45.99/product-page. What's the best ways to solve these duplicate content issues in this case? Many thanks!
White Hat / Black Hat SEO | | Jade0 -
Strange referral site: www.cyberonlineclicking.com would like some insights from the community
Hello Mozzers! I've noticed that our site has been receiving a significant amount of referral traffic from a rather suspect looking site: www.cyberonlineclicking.com Can anyone shed any light on this beast. Stopped receiving traffic around 11th November, but was getting 20K sessions over a 4 week period. The traffic was of poor quality, but would be good to know how or why they were linking to my site (fejobs dot com). Looks very suspicious. Thanks Justin
White Hat / Black Hat SEO | | Eteach_Marketing0 -
SEO for Career sites and sup-pages
For main job categories: We manage several career pages for several clients but the competition for the main keywords (even several long tail) is from big names like Indeed and similar job boards?
White Hat / Black Hat SEO | | rflores
What would you recommend? For job posts: Since the job posts that our clients post are short lived (80% live less than a month) would it still be incorrect to purchase backlinks? or is it always a big no Thanks for your help. And if a similar question has been asked I would appreciate if you could point me to it. I could not find one.0 -
Site that's 301 redirected is ranking for brand
We own a number of foreign TLD domains for our brand. They are all 301-redirected to our main .com branded domain. One of them is appearing in our branded search results, outranking out main .com page. To be clear, this is despite there being a 301 redirect from it to the .com page. Any ideas on what is going on here?
White Hat / Black Hat SEO | | ipancake0 -
Our site has too many backlinks! How can we do a bad backlink audit?
Webmaster Tools is saying we have close to 24 million links to our site. The site has been around since the mid 90s and has accumulated all these links since. We also have our own network of sites that have links in their templates to our main site. I'm fighting to get these links "nofollow"'d but upper management seems scared to alter this practice. This past year we've found our rankings have dropped significantly and suspect it's due to some spammy backlinks or being penalized for doing an accidental link scheme network. 24 million links is too many to check manually for using the disavow tool and it seems that bulk services out there to check backlinks can't even come close. What's an SEO to do?
White Hat / Black Hat SEO | | seoninjaz0 -
Getting Back Links When I Cannot Add Outbound Links to My Site
I have a collection of websites that I do not control in terms of content or page creation/editing. As a result, I have no way to add links to outside sites on any existing or new pages. Given this, how can I go about finding and requesting other sites link back to our sites/pages if I cannot offer them a link to their site in return? I know that content is a link driver, but I do not control the content, so I cannot develop new content to help drive links. I appreciate any help/advice any experts can provide.
White Hat / Black Hat SEO | | dsinger0 -
Partner Site Hit with Penguin - Links hurt me
I work for a network of international websites, the site I work on is for Canada. Our partners in Australia were hit by penguin hard because they hired a black hat SEO guy and didn't know. He was creating profiles on highly authoritative sites and keyword stuffing them. Now, they've completely dropped off the SERP. This is where the issue occurs, because we are all international partners we are all linked together on the header of every page so visitors can choose their country. Now, because they were hit hard and we have reciprocal links (not for rankings but for usability) will we be affected? It seems like we have, but I just want some opinions out there. Also, should we go ahead and stop linking our sites between countries to avoid this mess?
White Hat / Black Hat SEO | | BeTheBoss0 -
Client Selling Links On One Site Hurt Their Other Site?
Hi, I have a client who is thinking about selling ads on one site they own via something like textlinkads.com. Do you think they run any risk of exposing their other sites to scrutiny, penalties or problems?
White Hat / Black Hat SEO | | 945010