3

Just today I synchronized a development website database with a production website database.

Now, my development website gives a "404 Not Found" error. The URL starts with HTTPS, and there is a red slash through the HTTPS text. The 404 page says "The server can not find the requested page: dev.greenbee-web.com/ilaimh/wp-admin/ (port 443). Apache Server at dev.greenbee-web.com Port 443".

I did not realize that the production website uses HTTPS ( I am an employee and so I'm not the only one working on this website). This made the development website now use HTTPS, but I want it to use HTTP. I can't figure out where, in any of WordPress's configuration files, I can make the development website go back to using HTTP.

Is there some setting in wp-config that is forcing my development site to use HTTPS? If not in wp-config, where is the setting that is forcing the site to use HTTPS?

Thank you

  • your development and staging enviroment should always match as much as possible the production enviroment. Not using the same protocol is a very big deviation which is not even justified in any way – Mark Kaplun Mar 27 '16 at 18:34
  • 1
    hello… First look in the global settings (url fields) of wordpress. After that in most cases, you have one file (and also some plugins) that can be related to your problem : in .htaccess file located in main directory of your wordpress website, you have to look after something like RewriteRule ^(.*)$ https://www.yoursite.com/$1 [R,L]… Also some security plugins or some "SSL" plugins can be responsible. – LoicTheAztec Mar 27 '16 at 22:54
  • @MarkKaplun - this is an unacceptable answer to the question. Please explain, in detail, how I can install a valid certificate for a server on a local network with an unroutable IP, or install a valid SSL certificate on a public server for an IP address. When moving from development to live you have to change all the URLs anyway. – Craig Jacobs Jan 27 at 19:23
3

There are 2 things you must do.

If you are using Apache server go to .htaccess and change the Rewrite and RewriteBase engine to

RewriteEngine On

RewriteCond %{SERVER_PORT} ^443$
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [R=301,L]

RewriteBase /
RewriteRule ^index.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /index.php [L]

If you are using Nginx something like this should work

server {
   listen 80 443;
   server_name example.com;
   # add ssl settings
   return 301 https://example.com$request_uri;
}

This would redirect the https to http

and go to the database through phpmyadmin or whatever you use go to wp_options and find and change the siteurl and home values from https://example.com to http://example.com

Clean your cache and try again. It should work without problem. If the site still asks for SSL check your wp-config.php file to see if it has this code

define('FORCE_SSL_ADMIN', true);

then change the 'true' to 'false'

Hope this helps you.

  • 1
    In my case it came down to your last suggestion, commenting out these lines: //define( 'FORCE_SSL_LOGIN', 1 ); //define( 'FORCE_SSL_ADMIN', 1 ); – TARKUS Jul 16 '18 at 22:37
0

There's a couple of factors here.

First of all, you might want to check the site settings in wp_options (or wp_X_options if you're in a multisite setup), especially the value of:

  • home
  • siteurl

The other tables you want to check are:

  • wp_blogs
  • wp_domain_mapping
  • wp_options
  • wp_site
  • wp_sitemeta

I don't know what sort of system you guys use to sync your dev DB with prod, but we have an SQL script we run after we clone a subset of the prod database.

UPDATE wp_dev.wp_blogs SET domain = REPLACE(domain, "https://produrl.com", "http://devurl.com");
UPDATE wp_dev.wp_domain_mapping SET domain = REPLACE(domain, "https://produrl.com", "http://devurl.com");
UPDATE wp_dev.wp_options SET option_value = REPLACE(option_value, "https://produrl.com", "http://devurl.com");
UPDATE wp_dev.wp_site SET domain = REPLACE(domain, "https://produrl.com", "http://devurl.com");
UPDATE wp_dev.wp_sitemeta SET meta_value = REPLACE(meta_value, "https://produrl.com", "http://devurl.com");

Replace wp_dev with your local database, and produrl.com and devurl.com as necessary. But notice that this changes the internal URLs from HTTPS to HTTP.

Finally, you may need to change your local WP config, and update these two settings:

define('FORCE_SSL_LOGIN', false);
define('FORCE_SSL_ADMIN', false);
0

Thank you Loic. Im using BackupBuddy to copy my active websites and restore on WAMP. One of the sites kept trying to use HTTPS. Ive been trying to install a cert on local wamp without any luck.

I did look at the directory of my locally restored site and removed the simple ssl folder.

Boom. It works now and stays on HTTP

Man that that was too easy. Thanks again.

-2

Your development and staging enviroment should always match as much as possible the production enviroment. Not using the same protocol is a very big deviation which is not even justified in any way.

Since it is your organization, just install the same certificate on your dev enviroment, or if it is bound to a specific IP for some reason, generate a new one for your dev enviroment.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.