Support » Localhost Installs » How to stop localhost from redirecting to https

  • gunkev


    I have two local website that I having been working on. Everything was working well but somehow when I run myserver and try to asses my site’s dashboard via localhost/gandt/wp-admin it redirects to https. I have checked only andit’s due to a one of the website with HTTP Strict Transport Security.

    I have tried some recommendated solutions to disable but it seems to not work

    1. I went to chrome://net-internals/#hstsand deleting localhost and
    2. Empty Cache and Hard Reload (
    3. removing cached images and files in chrome://settings/clearBrowserData
    4. Checking the disable cache in Chrome developer tools> network tab.

    nothing seems to work. Please can anyone help?

Viewing 6 replies - 1 through 6 (of 6 total)
  • Moderator bcworkz


    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.

    Yabesh Photography


    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.

    Thread Starter gunkev


    @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.

    Yabesh Photography


    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.

    Thread Starter gunkev


    @yabeshphotographycoimbatore I have tried all those methods none seems to be working.

    Amjad Shuvo


    You can do the full installation again or re-install wordpress. Cause in localhost your page will come when you goto localhost only. It will automatically redirect to the working directory.

    1. Reinstall wordpress in XAMPP. OR

    2. Uninstall current XAMPP. Remove all folder and then install XAMPP again. Then install wordpress.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘How to stop localhost from redirecting to https’ is closed to new replies.