Hosting & Domaining Forum

Hosting Discussion => Hosting Security and Technology => Topic started by: Stranger on Jul 25, 2022, 09:34 AM

Title: Site transition from http to https
Post by: Stranger on Jul 25, 2022, 09:34 AM
I transferred the website to a new hosting provider due to inadequate conditions from the previous one. Although I managed to set up almost everything, I am unable to change the site from HTTP to HTTPS. The site is on Wordpress, and the new hosting provider has different settings, which have resulted in 301 errors.
 Thankfully, I have a valid SSL certificate from GoGet for my domain and subdomain. I am unsure about where to start troubleshooting this issue.
Title: Re: Website transition from http to https
Post by: _AnnA_ on Jul 25, 2022, 10:46 AM
I understand that you installed an SSL certificate on the server panel?
Check if it works correctly: https://www.sslshopper.com/ssl-checker.html
Next, set up 301 redirects. After connecting the SSL certificate, you should register a page redirect from URLs from http to https in the .htaccess file.
So:

RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^(.*)$ https://YOUSITE.DOT/$1 [R=301,L]

Next, change in the WP http panel to https. There should be two lines.
We check the absence of internal links to unprotected dоcuments.
We check for 301 redirects from all pages of the site to similar pages with https.
Update the .xml sitemap to only contain https pages.
We change the link to the sitemap (if it was with the http protocol) in the Robots.txt file.

More or less like this.
Title: Re: Website transition from http to https
Post by: Sevad on Jul 25, 2022, 11:05 AM
I have just done redirects for current (dnray.com) site.
From https to http
And from www. to without-www
See code below in .htaccess

RewriteEngine on
RewriteBase /

RewriteCond %{HTTPS} on
RewriteRule (.*) http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

RewriteCond %{HTTP_HOST} www.dnray.com
RewriteRule (.*) http://dnray.com/$1 [R=301,L]


As I see, it works.
Please verify if site works correctly.
Hope it will be helpful for someone)
Title: Re: Website transition from http to https
Post by: _AnnA_ on Jul 26, 2022, 02:04 AM
Yes, it does work for www. to without www.
You can do this for https to http :

Rewrite Engine On
RewriteCond %{ENV:HTTPS} =on
RewriteRule ^(.*)$ http://yousite.dot/$1 [R=301,L]

But if there is no active SSL certificate issued by a certification authority, then site visitors will see a browser warning about insecure content. And before the redirect works.

Our friend has the exact opposite task: to send all pages of the site from http to https. Here is another option how to do it:

Rewrite Engine On
RewriteCond %{HTTPS}=off
RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI} [QSA,L]

If a circular redirect occurs, you need to add:

Rewrite Engine On
RewriteCond %{HTTPS} off
RewriteCond %{HTTP:X-Forwarded-Proto} !https
RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]

Probably so.
Title: Re: Website transition from http to https
Post by: Stranger on Jul 27, 2022, 05:24 AM
I've been struggling for a solution for two days without success. We managed to debug something, but the images, which are very numerous, do not have https but http values.
Nothing helps.

It was for this moment that I did the following.
1. Used several plugins, including
Velvet Blues Update and Better Search Replace.
Unsuccessfully.
2. Registered redirects in .htaccess
Changed the site's main protocol from HTTP to HTTPS "Settings → General in the WP admin panel."
3. Looked at all .php and .ini files for http links.
4. Made all absolute links in files relative.
Did not help.
Of course, you can manually make changes to each image, but there are several thousand of them.
Title: Re: Website transition from http to https
Post by: _AnnA_ on Jul 27, 2022, 06:46 AM
Classic, mixed content. :)

This is how you can replace http://YOUDOMAIN.com with https://YOUDOMAIN.com in all css files in the current and subdirectories:
find. -name "*.css" -exec sed -i 's|http://YOUDOMAIN.com|https://YOUDOMAIN.com|g' {} \;

Execute a command from the theme directory. Replace the domain with yours.
And just in case, before doing this, make a backup of all files.
Title: Re: Website transition from http to https
Post by: _AnnA_ on Jul 27, 2022, 10:31 AM
Stranger, if you have not made changes to mySql, you can make a change request.

Item 16, here (https://silvawebdesigns.com/17-time-saving-wordpress-sql-queries-for-wordpress/).

Be sure to backup your database.
And look at links to external resources. With relinking it seems decided?
Title: Re: Website transition from http to https
Post by: Stranger on Jul 27, 2022, 01:34 PM
I did everything, I checked everything. There are no troubles.
Doesn't switch to https. The certificate is valid for another month.
I think there should be a magic button: "Enable https".
How to find it?
Title: Re: Website transition from http to https
Post by: Ali_Pro on Jul 28, 2022, 03:41 AM
Magic button?
Just put Really Simple SSL (https://wordpress.org/plugins/wp-mail-smtp/).
Working with the plugin is not difficult. Everything is described by the developer. The free version should be enough.
Title: Re: Website transition from http to https
Post by: Stranger on Jul 28, 2022, 06:09 PM
Finally my website is working properly!
Many thanks to everyone who helped in such a nerve-wracking matter!

Ali_Pro, thanks for the link, although it is not entirely correct. I found the plugin by the name in Google, here is the correct link (https://wordpress.org/plugins/really-simple-ssl/). I think it will help someone else.
Title: Re: Website transition from http to https
Post by: judii on Sep 18, 2022, 06:22 AM
To ensure that search engines do not perceive HTTP and HTTPS versions of a website as two different resources, it is necessary to configure a 301 redirect from HTTP to HTTPS. This process is akin to transferring the site to another domain. It must be a direct and straightforward redirection that does not include intermediate dоcuments to avoid confusing search robots and negatively affecting site perception. Alternatively, you can redirect using .htaccess if your site is hosted on an Apache server.

Moreover, you must configure internal linking to all elements, such as JavaScript, CSS, and images, replacing URLs from HTTP to HTTPS. It is crucial to ensure the proper functioning of external scripts and images over HTTPS. Inform search engines about your site's transition to HTTPS by updating the file with the directives for the search robot robots.txt and the site map sitemap.xml. Additionally, update your website URL on social networks and traffic tracking systems like Google Analytics. Create a new entry for the HTTPS resource in Google Webmaster Tools so that search engines can index and provide the content of your resource at the new URL.

Monitor the site daily with HTTPS in Google Webmaster Tools and Google Analytics to prevent possible problems with indexing and displaying your site. However, this transition may cause fluctuations in traffic volumes and site positions, since the 301st redirect transmits only 90 to 99% of the link weight. Lastly, the problem can also be solved using PHP code or by following the provided .htaccess file.
Title: Re: Site transition from http to https
Post by: webxpertindia on Jun 10, 2024, 10:41 AM
First and foremost, it's essential to ensure that the SSL certificate from GoGet for your domain and subdomain is properly installed and activated on the new hosting server.

To start troubleshooting the HTTPS issue, I recommend following these steps:


1. SSL Certificate Installation Verification:
  - Log in to your new hosting provider's control panel and locate the SSL certificate section. Verify that the SSL certificate for your domain and subdomain is installed and activated. Check for any error messages related to the installation process. If the SSL certificate is not properly installed, you might need to re-install it or seek assistance from your hosting provider's support team.

2. WordPress URL Settings Update:
  - Log in to your WordPress dashboard and navigate to Settings > General.
  - Update the WordPress Address (URL) and Site Address (URL) fields to include HTTPS. For example, change "http://yourdomain.com" to "https://yourdomain.com". This ensures that WordPress generates links using HTTPS.

3. Verify .htaccess File:
  - Access your website's .htaccess file via FTP or the file manager in your hosting control panel.
  - Check if there are any existing redirection rules or settings that force HTTP instead of HTTPS. If necessary, update the .htaccess file to ensure proper HTTPS redirection.

4. Update Permalinks:
  - In the WordPress dashboard, navigate to Settings > Permalinks.
  - Simply click "Save Changes" without modifying anything. This action refreshes the rewrite rules and ensures they are using HTTPS.

5. Mixed Content Issues:
  - Use a tool like WhyNoPadlock or the browser's developer console to identify mixed content issues on your website.
  - Update any internal links, images, scripts, or other resources to use HTTPS. This includes updating the URLs of resources in your WordPress content and theme files.

6. Plugin Compatibility Check:
  - Some WordPress plugins may conflict with HTTPS. Temporarily deactivate all plugins and then re-enable them one by one. Test the website after re-enabling each plugin to identify any compatibility issues with HTTPS.

7. Clear Cache:
  - If you are using any caching plugins or server-level caching, ensure that you clear the cache after making HTTPS-related changes. This ensures that the updated content is served to your visitors.

8. Test with Different Browsers:
  - After making changes, it's important to test your website using different browsers. This helps ensure that the HTTPS setup is consistent across various platforms and browsers.

9. Redirects and Server Configuration:
  - If you are experiencing specific 301 errors related to redirects, review the server configuration. Ensure that any redirection rules are properly set up to redirect HTTP to HTTPS without causing any conflicts.

10. Backup and Support:
  - Before making substantial changes, ensure that you have a recent backup of your website.
  - If you encounter persistent issues, don't hesitate to reach out to your hosting provider's support team for assistance. They can often provide valuable insights and guidance for resolving HTTPS-related issues.
Title: Re: Site transition from http to https
Post by: usman2000x on Jun 14, 2025, 02:21 AM
First, dive into your WordPress dashboard and update the site URL in Settings > General to use "https://".
Then, peek into your .htaccess file and slap in a redirect rule to force HTTPS—standard stuff for dodging those redirect loops. Also, check if your host's control panel has an SSL/TLS toggle or force HTTPS option, some hosts are sneaky with their configs. If the 301 errors persist, it might be a plugin clash-deactivate the usual suspects like caching plugins and test.
Title: Re: Site transition from http to https
Post by: Ocean Tattoos on Sep 23, 2025, 02:54 AM
Migrating from HTTP to HTTPS enhances website security, boosts SEO rankings, and fosters user trust. It's essential to implement proper redirects and update internal links to maintain SEO equity. This transition is crucial for modern websites.