• Please read the entire thing before answering.

    My blog is blog.ohok.org and I have an SSL certificate for ohok.org (only that, no wildcard for subdomains). The root of my blog is at blog.ohok.org and the files are lying on ohok.org/blog.
    I would like to offer optional SSL on my blog – you click a link and it redirects you for blog.ohok.org to https://ohok.org/blog.

    My first issue with that is that when I visit ohok.org/blog, probably because my root is blog.ohok.org, my blog looks quite broken and clicking any link will redirect to the original blog.ohok.org. Is there a hack or plugin that will allow me to visit my blog using both methods? For example, I visit blog.ohok.org and click links and posts and I will stay on that subdomain, when I visit ohok.org/blog and I click links I move around on ohok.org/blog/…

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hello,

    I would recommend updating your configuration so that the subdomain redirects to the subdirectory and the WP installation is configured to run from the subdirectory exclusively.

    That said, here is what I might try for what you’ve actually requested:

    It is possible to have WP configured to run from any URL that resolves to the installation by setting the values of siteurl and home dynamically in wp-config.php:

    define( 'WP_SITEURL', 'http://' . $_SERVER['SERVER_NAME'] . '/path/to/wordpress' );
    define( 'WP_HOME', 'http://' . $_SERVER['SERVER_NAME'] . '/path/to/wordpress' );

    In your case, you may need to modify this and wrap it in some logic that checks if the HTTPS protocol is in use: if ( ! empty( $_SERVER['HTTPS'] ) ) { ... }

    Thread Starter CrisisCorE

    (@crisiscore)

    Nice idea, thanks!

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Use HTTPS on a subdomain with a non-wildcard certificate’ is closed to new replies.