My website is currently https. But when attempting to browse it on a new computer, it always shows ERR_CONNECTION_REFUSED unless I turn it from http://mywebsite.com to https://mywebsite.com and then it's fine after that since it's saved to the browser.
How can I allow http connection to https website? I tried
RewriteEngine On
RewriteCond %{HTTPS} !=on
RewriteRule ^/?(.*) https://%{SERVER_NAME}/$1 [R,L]
But it's still the same.
Server: Apache2
on certbot, allow redirects so it will do the ReWrite code for you.
Related
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.
When we enter example.com in browser address bar it will redirecting to https://example.com and also inner pages working (redirecting to https site),
Issue 1:
When we enter www.example.com in browser address bar it is not redirecting to https://www.example.com and Site loading without https, but inner pages are redirecting to https
Issue 2:
https://example.com/file.php shows current content, but http://www.example.com/file.php shows old content, We checked in Incognito mode and clearing the caches
Issue 3: (this may be the root cause of the issues)
When we are seeing the $_SERVER parameters by accessing the url http://www.example.com/server.php shows HTTPS value as on
We print_r the $_SERVER in server.php file
Environment:
Godaddy VPS Server
Apache 2.3.1 (mod_rewrite enabled)
PHP 5.4.45
Wordpress
Valid SSL Certificate Configured - Required Ports are opened (80, 443)
In Wordpress Settings,
we placed https address for both Site url and Home page url as https://example.com
we used the below code in .htaccess for redirection
RewriteCond %{HTTPS} !on [OR]
RewriteCond %{HTTP_HOST} ^www\.example.com$
RewriteRule ^(.*)$ https://example.com%{REQUEST_URI} [L,R=301]
And we also checked in below sites and they are showing positive response for SSL
https://www.sslshopper.com, whynopadlock.com
Everytime We checked by clearing cache and cookies
DNS Records:
A (Host)
Host # Points To xx.xx.xx.xx with TTL 600 Seconds
CName (Alias)
Host www Points To # with TTL 1 Hour
Please suggest how can i resolve this issue with www.example.com to https
I am using below code in .htaccess file to redirect http request to https.
RewriteCond %{SERVER_PORT} !^443$
RewriteCond %{HTTP_USER_AGENT} !MSIE/[1-8]\. [NC]
RewriteCond %{HTTP_HOST} www.example.com
RewriteRule ^.*$ https://www.example.com%{REQUEST_URI} [L,R=301]
RewriteCond %{HTTP_HOST} ^www.%{HTTP_HOST} is an invaild condition and it never returns true because you can not use server variable in RewriteCond's pattern. You can use Regex based pattern like the following :
RewriteCond %{HTTP_HOST} ^www\.example.com$
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]
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.
I have recently implemented the HTTPS/SSL on a website. I have impleted it correctly and everything works correctly accept 1 issue.
When I got to www.domain.com or doamin.com directly it doesnt go to the https://www.domain.com instead it just stays on the non https link. How can this be fixed?
My site is on Wordpress and using W3TC Page Cache plugin
In the .htaccess file in the root of your server, or in the Apache config add a rewrite rule to redirect HTTP to HTTPS:
RewriteEngine on
RewriteBase /
RewriteCond %{HTTPS} off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}
Test the rules on http://htaccess.madewithlove.be/.