top button
Flag Notify
    Connect to us
      Site Registration

Site Registration

How to track down WordPress site from unwanted redirect to HTTP?

0 votes
519 views

I need to force HTTPS for my e-commerce site, but when I try, it goes into an HTTPS -> HTTP -> HTTPS loop. I reviewed my .htaccess, by couple of experienced techs but they found no issue on that. I checked my wp_config.php, and nothing there. Where else should I be looking? How would I hunt this down?

posted May 29, 2017 by Biswajit Maity

Share this question
Facebook Share Button Twitter Share Button LinkedIn Share Button

1 Answer

0 votes

You can use this code inside functions.php

function fun_force_https () {

  if ( !is_ssl() ) {
    wp_redirect('https://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'], 301 );
    exit();
  }
}
add_action ( 'template_redirect', 'fun_force_https', 1 );

It will force and correctly redirect the https URL and remove unwanted http redirects back from https.

answer Jun 3, 2017 by Arun Angadi
Similar Questions
0 votes

I want to send a user, logging out of WordPress, to a custom URL.
I used this below code into functions.php in my wordpress theme:

add_filter( 'logout_url', 'my_logout_url' );
    function my_logout_url( $url ) {
       return 'http://yourdomain.com/?a=logout';
    }

But it does not work.
How can I do this?
Many thanks in advance for your help or advice.

0 votes

I want to change a role in my wordpress plugin.

if ( is_admin() && ! is_user_logged_in() && ! defined( 'DOING_AJAX' ) && $pagenow !== 'admin-post.php' ) {
            wp_die( __( 'This has been disabled', 'wp-hide-login' ), 403 );
        }

        $request = parse_url( $_SERVER['REQUEST_URI'] );

When my plugin get the action, Wordpress shows "This has been disabled" under WP default (admin-post.php) page. But I need when my function get assign it's redirect to 404 page.

As like as "This has been disabled" > http://www.example.com/404

0 votes

In my wordpress site I have a picture in header section. On a full screen it looks ok but on mobile and when minimized the picture is on the left of the page. I would like it to be on the right. I thought that maybe I had to use CSS to reposition it so I did the following:
.widget-header img { float: left; } to .widget-header img { float: right; }
in hopes that it would work. However nothing seems to have changed. Can anybody help me how I fix this problem?

0 votes

I am a beginner in WordPress. I have already set up my WordPress-Theme for Desktop and I am happy with it and now I have tried to make some tweaks in the theme for the mobile device, but when I open my page on my mobile phone, those changes don't show up.

I have tried to make the theme for mobile device by overwriting the CSS-Selectors with the following:

@media (max-width: 700px) {
    …
}

But this is does not work on mobile device. How can I solve this? Can anybody help me?

0 votes

I want to create a separate custom 404 page for my wordpress site that when 404 error occurs then that page will be display. I create a 404 page but when I tried to test it, the 404 page of the root site appears. Can anybody help me?

...