13

I've installed WordPress and setup the database.
I go to the address and the setup page is there, but no CSS.
I think: something's wrong, but if I just do the setup maybe everything will just go back to normal.
No.
So then I spend a while looking through search results for WordPress styles not working etc.
I discover that all the links are present in the head of the page(s), and they point to the right pages, but they are not being loaded.
WordPress is trying to use a secure connection, but I don't have an SSL certificate or anything like that and I shouldn't think I'll need one for this either. This means that all the links to stylesheets and scripts are seen as untrustworthy and blocked.
I changed my searches to point in the direction of disabling https / ssl, but nothing I have found works.
E.g. I've tried adding stuff to my .htaccess file (lost the link to another related question on this site)
I've tried to find lines like define( 'force_SSL', true ); in wp-config.php but to no avail (related question). I've tried adding these lines (switching them to false) as well.

Thanks for any help.

Solution: The problem was not what I thought it was. Dataplicity (I am running off a pi) forces use of HTTPS, but as wordpress wasn't using HTTPS, the 'insecure' scripts weren't being loaded. All I needed to do was enable HTTPS.

I'm sure the answers below would have helped if my problem was what I thought it was, and I hope they'll help others with the same problem as I thought I had.

1
  • You should use HTTPS, not doing so is insecure, and has poor SEO and page speed penalties. Also, can you post your answer as an answer?
    – Tom J Nowell
    Aug 28, 2020 at 14:51

8 Answers 8

15

Check your wp-config.php file for lines like:

define( 'WP_SITEURL', 'https://example.com' );
define( 'WP_HOME',    'https://example.com' );

Also check your database's {prefix}_options table:

SELECT * FROM wp_options WHERE option_name='siteurl' OR option_name='home';

...assuming that your database's prefix is wp_.

2
  • There are no lines like that in my wp-config.php and I already checked the options table and that says http://example.com for both
    – cCe.jbc
    Feb 14, 2017 at 17:11
  • 2
    To note, if you set the constants, you don't need to update the options rows for home and siteurl. Feb 14, 2017 at 18:17
7

You can modify .htaccess file:

RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]
1
  • This was the only solution that helped me on localhost (xampp). Sep 6, 2018 at 9:42
2

Issue must be siteurl and home values are updated in the database with https, to fix it do following.

To bring site instantly up, add following lines under existing define statements in wp-config.php. This will override database values. you can updated your domain name instead of localhost.

define( 'WP_SITEURL', 'http://localhost');
define( 'WP_HOME',    'http://localhost');

Fix https database references

Go to phpadmin and execute following query and search for https in Filter rows as shown in the below picture. if you find home and siteurls with https, replace it with http

SELECT * FROM wp_options

enter image description here

Once you have removed https from the database. remove following lines from wp-config.php. and restart apache.

define( 'WP_SITEURL', 'http://localhost');
define( 'WP_HOME',    'http://localhost');

Your site should be up. good luck!

1

Please check your website URL set from the settings. This can be done trough the database like Pat Said, but if your not that tech savvy and you can still access the WordPress admin, use that.

Go to Settings -> General and check WordPress Address (URL) and Site Address (URL). These should start with http instead of https.

1
  • I've solved, the problem. But the problem wasn't what I thought it was. You can see the solution in my question. I think this, and the other answers here would have worked if this was the problem. By the way, I couldn't log into admin (it was insecure) so I couldn't have gone to settings. As I said to Pat, I already checked the database anyway.
    – cCe.jbc
    Feb 20, 2017 at 7:36
1

In my file wp-config.php I have:

define('WP_SITEURL', FLYWHEEL_DEFAULT_PROTOCOL . 'example.com');
define('WP_HOME', FLYWHEEL_DEFAULT_PROTOCOL . 'example.com');

You need find this string:

define('FLYWHEEL_DEFAULT_PROTOCOL', 'https://');

And change https:// to http://

0

Following Pat's answer. You can try adding these 2 lines to your wp-config.php file to see if this fixes the error:

define( 'WP_SITEURL', 'http://example.com' );
define( 'WP_HOME',    'http://example.com' );

This will force WordPress to use http version of your domain. If this fixes the issue, something in the database is causing this.

If you have any plugins setup, make sure to also disable all of them to make sure none of them are causing this issue.

Also, I recommend using Chrome's Incognito mode or Firefox's Private mode to visit your website and see if the HTTPS is still being used by WordPress.

If it's working in the Incognito mode (WordPress uses HTTP correctly), than you should try clearing your browser cache. I've seen browser cache redirecting http traffic to https before, even if https isn't working. I would recommend making sure it's not cache.

2
  • Doesn't seem to affect anything, even in incognito/private. Do you mean browser plugins? I haven't used wordpress before and haven't done anything on it apart from setup and editing .htaccess and wp-config.php to try and get rid of this issue.
    – cCe.jbc
    Feb 14, 2017 at 18:38
  • @cCe.jbc it is weird. I was referring to WordPress plugins, but it sounds like you might not have any active yet. What does your .htaccess file look like? Is it default htaccess or you got something in there? You can see basic htaccess here: codex.wordpress.org/htaccess
    – Viktor
    Feb 15, 2017 at 13:57
0

In my case, there were a plugin that force redirect to https. So, also check if any plugin is active and redirect requests to https.

0

Check your wp-config.php file for lines like:

define( 'WP_SITEURL', 'https://....' );
define( 'WP_HOME',    'https://.....' );

If you are using linux server, then edit or create an .htaccess file in your WordPress folder with the followin in it:

RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]

Or the better option is

If you have successfully installed the WordPress then go to settings>general>

WordPress Address (URL): change this from https to http
Site Address (URL): same with this

2
  • I've solved, the problem. But the problem wasn't what I thought it was. You can see the solution in my question. I think this, and the other answers here would have worked if this was the problem. By the way, I couldn't log into admin (it was insecure) so I couldn't have gone to settings.
    – cCe.jbc
    Feb 16, 2017 at 21:09
  • Great @cCe.jbc :) Feb 16, 2017 at 21:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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