5

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.

6

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

  • 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 '17 at 17:11
  • 2
    To note, if you set the constants, you don't need to update the options rows for home and siteurl. – Brian Fegter Feb 14 '17 at 18:17
  • Those constants are wrong. Should be 'WP_HOME', 'WP_SITEURL' – ngearing Feb 15 '17 at 0:17
  • Right you are, @Nath. That's what I get for doing this from memory. – Pat J Feb 15 '17 at 4:05
3

You can modify .htaccess file:

RewriteEngine On
RewriteCond %{HTTPS} on
RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]
  • This was the only solution that helped me on localhost (xampp). – Henning Fischer Sep 6 '18 at 9:42
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.

  • 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 '17 at 7:36
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.

  • 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 '17 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 '17 at 13:57
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 .htaccess file in wordpress dir

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>genral>

WordPress Address (URL) :charge this form https to http Site Address (URL) : same with this

  • 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 '17 at 21:09
  • Great @cCe.jbc :) – Arvind Singh Feb 16 '17 at 21:10
0

If file wp-config.php 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

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!

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.