Was this site cloned from a production site? Review the installation’s .htaccess file and comment out any rules that redirect or rewrite to https://. Also comment out any header rules regarding Strict-Transport-Security:.
Be sure the site and home URLs in settings use http:// protocol. Consider using Better Search and Replace plugin to seek out any local https:// references in the DB and change them to http://.
It’s also possible to set Strict-Transport-Security: headers from Apache config files or the server’s virtual host file. I suppose some sort of WP security plugin could also be responsible for the header. Where ever it comes from, disable it.
If you’re running WordPress on your local development environment and it’s automatically redirecting to HTTPS, you can try the following steps to stop the redirect:
Check your WordPress settings: Log in to your WordPress dashboard and go to Settings > General. Make sure that both the “WordPress Address (URL)” and “Site Address (URL)” fields start with “http://” and not “https://”. If they start with “https://”, change them to “http://” and save the changes.
Disable any HTTPS-related plugins: If you’re using a plugin that forces HTTPS, try disabling it temporarily to see if it’s causing the redirect. You can also check if there are any HTTPS-related settings in your plugins and disable them if necessary.
Check your .htaccess file: If you’re using Apache as your web server, check your .htaccess file in the root directory of your WordPress installation. Look for any lines that redirect to HTTPS and comment them out or remove them. Make sure to create a backup of the file before making any changes.
Check your SSL/TLS settings: If you’re using a tool like XAMPP or MAMP to set up your local development environment, make sure that SSL/TLS is not enabled. If it is, disable it and restart your web server.
By following these steps, you should be able to stop localhost from redirecting to HTTPS in WordPress. If you’re still experiencing issues, you may want to consult the documentation for your web server or development environment for additional troubleshooting steps.
@bcworkz and @yabeshphotographycoimbatore I can’t even login in my local website. Each time I type localhost/mywebsite/wp-admin, I am redirected to https. I have checked my .htaccess file there is no https configuration. I equally checked httpd-ssl.conf and httpd.conf. There is no https configuration. I am using XAMPP.
Everything was working perfectly but after putting my website online, the localhost website redirects to the online version. I don’t want to edit the online version directly.
To fix this issue, you can try the following steps: 1. Check if mod_rewrite is enabled in your XAMPP installation. It should be enabled for the localhost version of the website to work. You can enable it by opening the XAMPP control panel and click on the “Apache (httpd) Config” button. 2. Make sure that the WordPress address (URL) and the site address (URL) are correct in the WordPress settings. If they are not correct, you will get a redirect error. 3. Check your .htaccess file and make sure that there are no redirect rules that are redirecting the localhost version to the online version. 4. Check the httpd-ssl.conf and httpd.conf file for any redirect rules that may be redirecting the localhost version to the online version. 5. Try clearing the browser’s cache and cookies and then try to access the localhost version of the website. I hope this helps. If you are still having issues, you may need to reach out to your web hosting provider for further assistance.
@yabeshphotographycoimbatore I have tried all those methods none seems to be working.