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
-
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 -
My site in 2 page
my site in 2 page how can i rank with this keywords in dubai legal translation in Dubai
White Hat / Black Hat SEO | | saharali150 -
Hacked site vs No site
So I have this website that got hacked with cloaking and Google has labeled it as such in the SERPs. With due reason of coarse. My question is I am going to relaunch an entirely new redesigned website in less than 30 days, do I pull the hacked site down until then or leave it up? Which option is better?
White Hat / Black Hat SEO | | Rich_Coffman0 -
Pharma Hack/Grey hat SEO. Cannot get site to rank, tons of incoming bad links
I have been working on a website trying to get it to show up in the SERPs again. It is being indexed which is great, it has some errors that I'm fixing now. But for the most part it should be ranking. It don't show any penalties going on, but when I did a backlink search we keep getting the cialis, viagra etc inbound links. First thought was Pharma Hack. But it's not a WP site and I recently rebuilt it. So whatever bad code could have been there it's not anymore. It doesn't show up in google either for the search site:www.mysite.com viagra cialis etc... So I'm wondering if anyone has any insight in a direction to point me? I don't understand what would be causing this to still not rank. Only thing it ranks for is it's name. Any suggestions would be very appreciated.
White Hat / Black Hat SEO | | WeBuyCars.com0 -
Can I leave off HTTP/HTTPS in a canonical tag?
We are working on moving our site to HTTPS and I was asked by my dev team if it is required to declare HTTP or HTTPS in the canonical tag? I know that relative URL's are acceptable but cannot find anything about HTTP/HTTPS. Example of what they would like to do Has anyone done this? Any reason to not leave off the protocol?
White Hat / Black Hat SEO | | Shawn_Huber0 -
Merging Sites - consolidation of your my web sites
I have had 3 tourism web sites for many years (each site represents a different place in Costa Rica) and they cross link with each other. www.monteverdetours.com is the main site - the most important one. In order to help ranking and to comply with all the new google changes.... I have recently been advised that (page by page, I should incorporate the other site, www, arenalvolcanotours.com into the monteverde site with 301s, In other words there will be a new directory on monteverde called /arenal-volcano-tours which will be the new home page for the arenal section. So page by page I can map the old URL's to the new URL's eg arenalvolcanotours.com/arenal-hotels-economy.html
White Hat / Black Hat SEO | | Llanero
301 redirect to
monteverdetours.com/arenal-volcano-tours/arenal-hotels-economy.html Now my monteverde site was once penalized by google and I am worried that doing this might have an adverse effect (although the thinking behind doing this change is because google prefers it to all the cross linking and also I will be able to consolidate all the links from Arenal into Monteverde). I respect the person who made the suggestion but I was interested in opinions from other people! I want to be positive this is a good ideas before undertaking this major work! Any opinions would be appreciated!0 -
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 -
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