Cancelled SSL, Google still takes user to HTTPS - wordpress

My problem is on a GoDaddy hosted Wordpress installation. I decided to move the site just a few days after adding SSL, and I left the certificate behind, I no longer want it. Many users are still seeing my site as https://example.com because Google indexed this, or because the site is in their cache. This is a big problem, because browsers throw up untrusted certificate warnings, and users don't continue on to the site.
I've been trying to solve this problem by:
Using Google Webmaster Tools and asking Google to re-crawl/re-index my URLs.
Trying to write a 301 redirect into my htaccess file, which would redirect from https to http.
My 301 redirects have not worked yet. I have read several articles and tried these code snippets:
RewriteCond %{SERVER_PORT} ^443$
RewriteRule (.*) http://example.com/$1 [R=301,L]
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule .* http://%{HTTP_HOST}%{REQUEST_URI}
I'm beginning to doubt that this will work. Does anyone know if it is possible?

In the end, only time healed this wound. Fortunately Google un-indexed my HTTPS address pretty quickly.

Related

oddness with http to https through .htaccess

So I put these commands in my .htaccess file
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
and something peculiar happened. In my HostGator access logs, I never saw reportage of download success (as in Apache code 200). I seemed to get mainly 301 redirect notifications. That is, people were downloading stuff fine, but I never saw any indication of that in my access logs. Can someone explain to me why that is? I am an Apache novice, so pardon my misunderstanding.
I removed those lines and, yep, all my expected code 200 notifications returned.

.htaccess: How can I rewrite a WordPress page/section to a subdomain?

I really struggle with .htaccess. I found some possible solutions here but they give me a "Cannot find server" error. I'm using an Apache server (SiteGround).
I have a page (with children) set up in WordPress, and we'd like them to act as a subdomain site while still being part of our WordPress install:
domain.com/new
domain.com/new/children
I'd like these things to happen:
new.domain.com should load the page at domain.com/new (URL should remain new.domain.com - not redirect)
The children should load as new.domain.com/children
entering domain.com/new or domain.com/new/children should redirect to the new subdomain equivalent.
I have tried:
RewriteCond %{REQUEST_URI} ^/new
RewriteRule ^new/(.*)$ http://new.domain.com/$1 [R,L]
Also:
RewriteCond %{HTTP_HOST} ^(www\.)?domain\.com$ [NC]
RewriteRule ^new/$ https://new.domain.com/ [R=301,L]
They both redirect /new/ to new.domain.com/ correctly, but the subdomain itself just has a "server not found" error. I tried making an A record pointing the subdomain to the root IP address.. (I have no idea, just a stab in the dark)
Or I'm using the wrong directives?
Not opposed to using WP_Rewrite or something in functions.php if it works better, but I also have no idea about those! I normally make static marketing sites!

How to Redirect my all post/page in Http to Https

I am using wordpress. Actually recently I updated my website with SSL certificate in that everything is done. I have added redirect code in my .htaccess file.
RewriteEngine On
RewriteCond %{HTTPS} off
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
But only Homepage working perfect. It's automatically redirecting
http://www.lyricstake.com to https://www.lyricstake.com, but all other pages/post requests did not get redirecting. I want redirect my all post requests automatically, for example http://www.name.com/post/ to
https://www.name.com/post/.
You have to change all the URLs in your database from http to https. For doing this you can use this plugin : https://wordpress.org/plugins/search-and-replace/
Make sure to take a full backup of your database before using this plugin.

Redirect Incoming HTTPS Url to My Site's HTTPS Version

My client has a site http://www.sitename.com and also has a secure https://www.sitename version. For Google Analytics traffic reasons, he needs to make sure that any users coming from an https url be redirected to the secure version and NOT the insecure url.
What would be the proper way to do this via .htaccess? I searched here and online in general couldn't find a specific answer.
You will have to force https for achieving your use case. Add this to your htaccess file.
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Enable https using Rewrite Rule for specific URLs

I am new to Apache and I am finding it extremely difficult to understand the rewrite rule syntax.
Here is my setup:
I have a Wordpress MU site at mydomain.com
I have parked domains site1, site2.com that point to mydomain.com
What I want:
I want this URL http://mydomain.com/wp-login.php to redirect to the same address but with https first. I have seen several tutorials on how to do this but there is a problem.
My problem:
If I use something like
#RewriteCond %{HTTPS} !=on
#RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
this also redirects my other sites to https versions because they are parked domains and effectively loading the same htaccess code; since the certificate I have is only for mydomain.com I get certificate errors.
I need to only secure pages on the mydomain.com but only the wp-login.php page. Another issue is that this page can move around in the URL, IE:
mydomain.com/wp-login.php
mydomain.com/somecracp/wp-login.php
mydomain.com/wp-login.php?xys=5653
I need a regex which will detect the domain name of mydomain.com and the wp-login.php anywhere in the URL. I then need to force https for them. Can anyone build me the code please?
UPDATE:
I may have found part of the issue. It would seem that the login page itself is also trying to do some redirection. When I access the admin section of the site http://mysite.com/wp-admin it detects that you aren't logged in; it then redirects you to the login page but appends a redirect_to query string at the end like so:
http://mydomain.com/subdomain/wp-login.php?redirect_to=http%3A%2F%2Fmydomain.com%2Fsubdomain%2Fwp-admin%2F&reauth=1
It seems to do this so that once you log in successfully it can redirect you to the admin section you previously tried to access. This "redirect_to" and what comes after it is the URL it will redirect to once you log in.
I won't to go into details as to why but is there a way I can force it overwrite the above URL to go to mydomain.com/wp-login.php with none of the rediret_to crap?
Try this:
RewriteCond %{HTTP_HOST} ^(www\.)?mydomain.com$ [NC]
RewriteCond %{HTTPS} !on
RewriteRule wp-login.php https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301,QSA]
The regex part of the RewriteRule checks to see if there is any instance of wp-login.php in the request, and if there is, redirect to https.
Try
RewriteCond %{HTTPS} off
RewriteCond %{REQUEST_URI} wp-login.php [NC]
RewriteRule https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
The rewriteCondition will check if https is off and request uri contains wp-login.php, then redirect.

Resources