• All,

    I converted my entire WordPress website to run over https. That said, though, I am having difficulty determining the proper htaccess configuration to force HTTPS for all URL calls. A few comments first:

    Wordpress Version: 4.9.7
    PHP Version: 5.6.32
    WordPress Address (URL): https://www.wounited.org/wp
    Site Address (URL): https://www.wounited.org/wp

    htaccess file contents:

    # Use PHP56 Single php.ini as default
    AddHandler application/x-httpd-php56s .php
    
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule (.*) https://%{HTTP_HOST}%{REQUEST_URI}/wp [R=301,L]
    
    # 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>
    # END WordPress

    The problem is that several important URL’s won’t resolve to https using the htaccess above (without using the https:// prefix).

    These URL’s resolve to HTTPS
    “wounited.org”
    “www.wounited.org”

    These URL’s DO NOT resolve to HTTPS
    “wounited.org/wp/”
    “wounited.org/wp/about_us/”
    “wounited.org/wp/faq/”
    “wounited.org/wp/contact_us/”
    “wounited.org/wp/donate/”
    “www.wounited.org/wp/”
    “www.wounited.org/wp/about_us/”
    “www.wounited.org/wp/faq/”
    “www.wounited.org/wp/contact_us/”
    “www.wounited.org/wp/donate/”

    (quotes added to keep the forum software from adding http prefix)

    I can use the plugin “Really Simple SSL” to handle the problem URL’s, but I’d rather handle these directly with the htaccess file.

    I suspect that the problem might be having the Site and WordPress URL’s the same.

    Any suggestions?

    Thank you,
    Mark

    • This topic was modified 7 years, 8 months ago by twoagc.
    • This topic was modified 7 years, 8 months ago by twoagc.
    • This topic was modified 7 years, 8 months ago by twoagc.

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Try using this in your htaccess

    
    # 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>
    # END WordPress
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteCond %{HTTPS} off
    RewriteRule ^(.*)$ https://%{HTTP_HOST}%{REQUEST_URI} [L,R=301]
    </IfModule>
    
    Moderator t-p

    (@t-p)

    Thread Starter twoagc

    (@twoagc)

    @jaycbrf & @t-p,

    Unfortunately, neither one of your suggestions worked … thanks for your efforts, though!

    All,

    I went ahead and modified the htaccess file to correct several issues. The new htaccess file contents:

    # Use PHP56 Single php.ini as default
    AddHandler application/x-httpd-php56s .php
    
    RewriteCond %{REQUEST_URI} !^/[0-9]+\..+\.cpaneldcv$
    RewriteCond %{REQUEST_URI} !^/\.well-known/pki-validation/[A-F0-9]{32}\.txt(?:\ Comodo\ DCV)?$
    RewriteEngine On
    RewriteCond %{SERVER_PORT} 80
    RewriteCond %{HTTP_HOST} ^wounited\.org$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.wounited\.org$ [OR]
    RewriteCond %{HTTP_HOST} ^wounited\.org\/wp$ [OR]
    RewriteCond %{HTTP_HOST} ^www\.wounited\.org\/wp$
    RewriteRule ^(.*)$ https://www.wounited.org/wp/$1  [R=301,L,NC]

    Bottom line, I need the following URL’s to resolve to HTTPS (without using the https:// prefix):

    “wounited.org” (Ok … Resolves to HTTPS)
    “www.wounited.org” (Ok … Resolves to HTTPS)
    “wounited.org/wp/” (Does NOT resolve to HTTPS)
    “www.wounited.org/wp/” (Does NOT resolve to HTTPS)

    Thanks again,
    Mark

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

The topic ‘HTTPS and HTACCESS Issues’ is closed to new replies.