Viewing 5 replies - 1 through 5 (of 5 total)
  • What do you mean when you say the URL reads? Are visitors actually getting redirected to that URL?

    For example, on my site https://perfmatters.io, it is running over HTTPS and here is example of one of the cache folders:

    perfmatters.io/wp-content/cache/cache-enabler/perfmatters.io/png-to-webp/index.html

    The folder after the cache enabler folder won’t have HTTPS on it. That is simply the folder in which the cache is stored. Are you saying visitors are actually seeing that URL in your browsers?

    Also, how did you do your .htaccess redirect? Usually the following is sufficient.

    RewriteCond %{SERVER_PORT} 80
    RewriteRule ^(.*)$ https://www.yoursite.com/$1 [R=301,L]
    Thread Starter dccs52

    (@dccs52)

    What do you mean when you say the URL reads? Are visitors actually getting redirected to that URL?

    Yes thats right, if the user accesses the url for example

    http://www.mysite.co.uk (without the https://)

    The homepage will load and the user will see the URL:

    https://www.mysite.co.uk/wp-content/cache/cache-enabler/www.mysite.co.uk/index.html

    Also, how did you do your .htaccess redirect? Usually the following is sufficient.

    Same as yours above

    RewriteCond %{SERVER_PORT} 80
    RewriteRule ^(.*)$ https://www.yoursite.com/$1 [R=301,L]
    Thread Starter dccs52

    (@dccs52)

    and to add this is my current htaccess

    # BEGIN Cache Enabler
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteBase /
    
    # set blog sub path
    SetEnvIf Request_URI "^(.*)$" SUB_PATH=/wp-content/cache/cache-enabler/
    
    # set Cache Enabler path
    SetEnvIf Request_URI "^(.*)$" CE_PATH=$1
    SetEnvIf Request_URI "^(/)index.php$" CE_PATH=$1
    
    <IfModule mod_mime.c>
    # webp HTML file
    RewriteCond %{ENV:CE_PATH} /$
    RewriteCond %{ENV:CE_PATH} !^/wp-admin/.*
    RewriteCond %{REQUEST_METHOD} !=POST
    RewriteCond %{QUERY_STRING} =""
    RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_
    RewriteCond %{HTTP:Accept-Encoding} gzip
    RewriteCond %{HTTP:Accept} image/webp
    RewriteCond %{DOCUMENT_ROOT}%{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}index-webp.html.gz -f
    RewriteRule ^(.*) %{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}index-webp.html.gz [L]
    
    # gzip HTML file
    RewriteCond %{ENV:CE_PATH} /$
    RewriteCond %{ENV:CE_PATH} !^/wp-admin/.*
    RewriteCond %{REQUEST_METHOD} !=POST
    RewriteCond %{QUERY_STRING} =""
    RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_
    RewriteCond %{HTTP:Accept-Encoding} gzip
    RewriteCond %{DOCUMENT_ROOT}%{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}index.html.gz -f
    RewriteRule ^(.*) %{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}index.html.gz [L]
    
    AddType text/html .gz
    AddEncoding gzip .gz
    </IfModule>
    
    # webp HTML file
    RewriteCond %{ENV:CE_PATH} /$
    RewriteCond %{ENV:CE_PATH} !^/wp-admin/.*
    RewriteCond %{REQUEST_METHOD} !=POST
    RewriteCond %{QUERY_STRING} =""
    RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_
    RewriteCond %{HTTP:Accept} image/webp
    RewriteCond %{DOCUMENT_ROOT}%{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}index-webp.html -f
    RewriteRule ^(.*) %{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}index-webp.html [L]
    
    # default HTML file
    RewriteCond %{ENV:CE_PATH} /$
    RewriteCond %{ENV:CE_PATH} !^/wp-admin/.*
    RewriteCond %{REQUEST_METHOD} !=POST
    RewriteCond %{QUERY_STRING} =""
    RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_
    RewriteCond %{DOCUMENT_ROOT}%{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}index.html -f
    RewriteRule ^(.*) %{ENV:SUB_PATH}%{HTTP_HOST}%{ENV:CE_PATH}index.html [L]
    
    # wp override
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [END]
    </IfModule>
    # END Cache Enabler
    
    RewriteCond %{SERVER_PORT} 80
    RewriteRule ^(.*)$ https://www.mysite.co.uk/$1 [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
    Thread Starter dccs52

    (@dccs52)

    Hi

    I managed to resolve this, it was just the order of the HTACCESS, i added the cache enabler htaccess code below the default wordpress rewrite and this solved my issue.

    RewriteCond %{SERVER_PORT} 80
    RewriteRule ^(.*)$ https://www.mysite.co.uk/$1 [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
    
    # Start Cache Enabler
    <IfModule mod_rewrite.c>
     RewriteEngine On
    
     <IfModule mod_mime.c>
     # webp HTML file
     RewriteCond %{REQUEST_URI} /$
     RewriteCond %{REQUEST_URI} !^/wp-admin/.*
     RewriteCond %{REQUEST_METHOD} !=POST
     RewriteCond %{QUERY_STRING} =""
     RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_
     RewriteCond %{HTTP:Accept-Encoding} gzip
     RewriteCond %{HTTP:Accept} image/webp
     RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/cache-enabler/%{HTTP_HOST}%{REQUEST_URI}index-webp.html.gz -f
     RewriteRule ^(.*) /wp-content/cache/cache-enabler/%{HTTP_HOST}%{REQUEST_URI}index-webp.html.gz [L]
    
     # gzip HTML file
     RewriteCond %{REQUEST_URI} /$
     RewriteCond %{REQUEST_URI} !^/wp-admin/.*
     RewriteCond %{REQUEST_METHOD} !=POST
     RewriteCond %{QUERY_STRING} =""
     RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_
     RewriteCond %{HTTP:Accept-Encoding} gzip
     RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/cache-enabler/%{HTTP_HOST}%{REQUEST_URI}index.html.gz -f
     RewriteRule ^(.*) /wp-content/cache/cache-enabler/%{HTTP_HOST}%{REQUEST_URI}index.html.gz [L]
    
     AddType text/html .gz
     AddEncoding gzip .gz
     </IfModule>
    
     # default HTML file
     RewriteCond %{REQUEST_URI} /$
     RewriteCond %{REQUEST_URI} !^/wp-admin/.*
     RewriteCond %{REQUEST_METHOD} !=POST
     RewriteCond %{QUERY_STRING} =""
     RewriteCond %{HTTP_COOKIE} !(wp-postpass|wordpress_logged_in|comment_author)_
     RewriteCond %{DOCUMENT_ROOT}/wp-content/cache/cache-enabler/%{HTTP_HOST}%{REQUEST_URI}index.html -f
     RewriteRule ^(.*) /wp-content/cache/cache-enabler/%{HTTP_HOST}%{REQUEST_URI}index.html [L]
    </IfModule>
    # End Cache Enabler

    Oh ok great. Sorry didn’t have a chance to look at your threads yet. Glad you got it resolved!

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

The topic ‘HTTPS and redirection issue’ is closed to new replies.