• Having a couple issues when attempting to redirect from HTTP to HTTPS. The site is a subdomain that I use for testing purposes. i’ll call it my.example.com for this post.

    1) After going into the admin page and changing the WordPress Address URL and Site Address URL to https://my.example.com, the settings get saved, the session times out and forces me to close/reopen the browser to see the website. This is fine except that I lose the ability to reach my admin login. Any attempts to locate the URL time out and/or redirect me to the site address.

    2) I am also having an issue with the 301 redirect code in htaccess. I am using the following but I can’t seem to place it correctly within htaccess so that it works:

    RewriteEngine on
    RewriteCond %{HTTP_HOST} ^example.com [NC,OR]
    RewriteCond %{HTTP_HOST} ^www.example.com [NC]
    RewriteRule ^(.*)$ https://www.my.example.com/$1 [L,R=301,NC]

    I have the standard code that comes after #Begin WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    RewriteRule ^index\.php$ – [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>

    as well as the firewall rules, etc added from All-In-One WP Security. It could possibly be a plugin conflict but its also likely I am not placing the 301 redirect correctly.

    3) I am also having a problem with the CSS in my theme breaking after changing the URLs to https://. In IE, the site looks semi-normal but my font.css is not reflected and a few items in my main css file. In Chrome/Firefox the site has no CSS at all and shows just the index of the pages. The CSS files are called with the get_template_directory function in my header.php file.

    Any help would be appreciated,

    Thanks

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter animagic

    (@animagic)

    Update, I have fixed the issue with my CSS. Needed to place a parse_url( ,PHP_URL_PATH) around get_template_directory.

    I still have an issue with wp-login.php being unaccessible though.

    Thread Starter animagic

    (@animagic)

    Just an update for anyone having HTTPS issues. I found that my issue was the Load Balancer that my server pair is behind. My host had not configured it properly to send the X-Forward-Proto header that a proxy requires. The LB is doing the SSL handling so it requires the header.

    wp-config.php requires the following which is noted in the wiki page https://codex.www.ads-software.com/Administration_Over_SSL

    define(‘FORCE_SSL_ADMIN’, true);
    if ($_SERVER[‘HTTP_X_FORWARDED_PROTO’\ == ‘https’)
    $_SERVER[‘HTTPS’]=’on’;

    What is not noted is a working 301 Redirect for proxy to make the entire site https://. I used the following:

    RewriteCond %{HTTP_HOST} ^my.example.com$ [NC]
    RewriteCond %{HTTP:X-Forwarded-Proto} !https
    RewriteCond %{HTTPS} off
    RewriteRule ^ https://%{HTTP_HOST}%{REQUEST_URI} [R=301,L]

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘HTTP to HTTPS’ is closed to new replies.