Hot answers tagged

43

For the login part, this works for me ... Paste the following line in your wp-config.php if ($_SERVER['HTTP_X_FORWARDED_PROTO'] == 'https') $_SERVER['HTTPS']='on'; but make sure that you do it before the following line require_once(ABSPATH . 'wp-settings.php'); By doing so you can get your admin panel back ... See details here Also to avoid getting ...


43

Here are few things you could try to remove the responsive image support in 4.4: /** * Disable responsive image support (test!) */ // Clean the up the image from wp_get_attachment_image() add_filter( 'wp_get_attachment_image_attributes', function( $attr ) { if( isset( $attr['sizes'] ) ) unset( $attr['sizes'] ); if( isset( $attr['srcset'] ...


20

Special thanks to user42826. According to the codex: If WordPress is hosted behind a reverse proxy that provides SSL, but is hosted itself without SSL, these options will initially send any requests into an infinite redirect loop. To avoid this, you may configure WordPress to recognize the HTTP_X_FORWARDED_PROTO header (assuming you have properly ...


13

The simplest and cleanest way to do this is simply this: add_filter( 'wp_calculate_image_srcset', '__return_false' ); To echo what most other folks are saying though, srcset is a good idea and is the future (best practice now), but if you need a quick fix to keep your site working, the above snippet does the job without any hacking. source: WP Core Blog


13

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


11

When I build themes, I also like to make the WordPress header as clean as possible and then reconstruct it to my own liking. The code below is excessive for your question, but it might help you with other 'WordPress inserted code' in the future. The key snippet of code you are looking for is wp_deregister_script('jquery'); wp_register_script('jquery', '', '...


11

New workflow, since the Admin SSL plugin is not supported. use the Plugin WP https See the settings If you want SSL for wp-admin, add this to the wp-config.php: define( 'FORCE_SSL_ADMIN', TRUE ); If you want also SSL for the log in page, add this to the wp-config.php define( 'FORCE_SSL_LOGIN', TRUE ); Add the follow line to the .htaccess; remove the ...


11

If you link to the JS file just using something like //examplesite.com/js/jsfile.js without the http:// or https:// the browser should automatically get the correct http or https version


11

You can try these: 1. make sure the values changed in database If you can't login to wp-admin > settings to confirm that, you can go to database, wp_options table and look for siteurl and home values 2. add code to wp-config.php Add these lines to wp-config.php define('WP_HOME','http://example.com'); define('WP_SITEURL','http://example.com'); 3. Clear ...


8

This is happening because WordPress saves URLs in content absolutely by default (meaning that it's actually got your urls saved as http://example.com in the database). So to fix this you'll want to run a search and replace in your database to fix those errors. I like to use the plugin Better Search Replace because it has a nice feature to let you try out ...


7

The answer to this came in part from this answer, which linked to the Codex, advising the following snippet to be placed at the top of the wp-config file: if (strpos($_SERVER['HTTP_X_FORWARDED_PROTO'], 'https') !== false) $_SERVER['HTTPS']='on'; Unfortunately, this didn't quite solve it for me, but I noticed it worked if I removed the if and just ...


7

Most likely, the reason the URLs in your srcset attributes are incorrectly showing HTTPS is because the URLs for all images are built using the value of the siteurl option in your wp_options table. If you're serving your front end over HTTPS, you should also change those values (via Settings > General). Here's the related ticket on the WordPress issue ...


7

Before I give you the CODE, let me explain a few points: Point 1: It's better if you only allow https links. Mixing http & https for the same content breaks the security added by https. With http, you can never be sure that your visitors are shown the same page you are providing from your server. Point 2: Search engines consider http & https ...


6

Since you are behind a load balancer (confirmed in your comments above), your WordPress installation won't be able to detect SSL using the is_ssl() function, and will not serve any enqueued scripts or stylesheets with https: protocol URIs. If you are behind a load balancer that supports the HTTP_X_FORWARDED_PROTO server variable, you can fix your problem by ...


6

Solution 1: Enable mod_header on the server and added this rule to my appache2.conf file: <IfModule mod_headers.c> RequestHeader unset HTTPS </IfModule> Solution 2: Or you need to add the code to fonction.php file of your current theme: function https_chrome44fix() { $_SERVER['HTTPS'] = false; } add_action('init', 'https_chrome44fix',0);


6

WordPress keeps WP_HOME and WP_SITEURL in DB, this is set during initial installation and usually is the domain of your website, in your case it is a domain with https. Your visiting site via local domain, but WordPress redirects to https live domain, causing redirect loop which obviously fails. To fix this, change WP_HOME and WP_SITEURL values in DB. Or ...


5

You can change it using following code, add it in your theme function.php or in plugin. remove_action ( 'wp_head' , 'rel_canonical' ) ; add_action ( 'wp_head' , 'my_rel_canonical' ) ; function my_rel_canonical () { ob_start () ; rel_canonical () ; $rel_content = ob_get_contents () ; ob_end_clean () ; echo str_replace ( "https:" , "http:...


5

I don't believe WordPress sends HTTPS requests unless it has been told to do so. It sounds like you need to undo some previous configuration -- most likely change/remove the FORCE_SSL_LOGIN constant. You may have plugins participating as well though. Make sure to check that. Reference: http://codex.wordpress.org/Administration_Over_SSL


5

This seems to be a bug that affects only Apache which is sending the user value for the header HTTPS as unprefixed header HTTPS instead of HTTP_HTTPS. You should be able to fix that with a simple plugin: if ( empty ( $_SERVER['SERVER_SOFTWARE'] ) ) return; if ( FALSE === stristr( $_SERVER['SERVER_SOFTWARE'], 'apache' ) ) return; if ( empty ( $...


5

This will disable the srcset code by eliminating any images wider than 1 pixel. add_filter( 'max_srcset_image_width', create_function( '', 'return 1;' ) ); In the long run, you should try to fix the actual problem. Still, this works if you need a quick fix.


5

You'll need to update all of the URLs in your database to the HTTPS protocol: Go and download Interconnect IT's Database Search & Replace Script here Unzip the file and drop the folder where your WordPress is installed (the root) and rename the folder to replace (screenshot) Navigate to the new folder you created in your browser (ex: http://example.com/...


5

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


5

You can modify .htaccess file: RewriteEngine On RewriteCond %{HTTPS} on RewriteRule ^ http://%{HTTP_HOST}%{REQUEST_URI} [R=301,L,NE]


5

This is because the site_url and homeurl of your original installation are set to HTTPS in the database, so you can't access your website on localhost unless you: Change these values to non-ssl Install a SSL certificate on localhost I will only explain the first case since installing a certificate is out of this community's scope. To do this, you have 2 ...


5

If you place your "custom" directives outside of any # BEGIN ... / # END ... comment markers then WordPress (and plugins) should not overwrite them when they update. (Of course, if you have plugins that don't "play nice" then they could do anything to .htaccess if you let them, so you would need to do something like what @haz suggests in this case.) In your ...


4

I encountered the same issue: with WordPress multisite, there is no option or setting that defines if a site domain is HTTP or HTTPS. Even after replacing all occurrences in the database, a site visitor can still enter and navigate the site in HTTP, without being redirected to HTTPS. The following simple solution worked for me: I added this mod_rewrite rule ...


4

Go to your WordPress General Settings and change the WordPress Address (URL) and the Site Address (URL) from HTTP to HTTPS. ps. And disable all the plugin breaking your site. If that doesn't fix this there is a proper guide here and several steps you can take: https://managewp.com/wordpress-ssl-settings-and-how-to-resolve-mixed-content-warnings


4

This type of CSS "breaking" is caused mostly due to accessing files via HTTP request on an HTTPS connection, or to be short, accessing insecure files. In the provided link, the Registration form is loaded in an iframe, and also, its CSS files are loaded by HTTP and not by HTTPS connection. So, if you have direct access to the files that is served as ...


4

Installing the WordPress HTTPS plugin should take care of it.


4

First, rename the folder wp-content/plugins/wordpress-https to wp-content/plugins/wordpress-https-OFF so that WordPress can't find it to run it. Second, add the following lines to your wp-config.php file, replacing the domain name with your domain name: define( 'WP_SITEURL', 'http://example.com/' ); define( 'WP_HOME', 'http://example.com/' );


Only top voted, non community-wiki answers of a minimum length are eligible