Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Support jarnovos

    (@jarnovos)

    Hi @nealbo,

    Strange indeed, as the .htaccess rules you shared in your post should be working for all pages; not just the homepage. Are these the full contents of your .htaccess file?

    I also see that you’re using a number of caching/optimization tools, could you also verify whether the behavior might already be corrected when such tools have temporarily been disabled?

    Kind regards, Jarno

    Thread Starter nealbo

    (@nealbo)

    Hi @jarnovos , there is quite a lot more in the htaccess:

    Caching plugins do not appear to have any effect when I’ve just tested now.

    # BEGIN LSCACHE
    # END LSCACHE
    # BEGIN NON_LSCACHE
    # END NON_LSCACHE
    #BEGIN Really Simple SSL LETS ENCRYPT
    RewriteRule ^.well-known/(.*)$ - [L]
    #END Really Simple SSL LETS ENCRYPT
    RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/([0-9]{2})/(?!page/)(.+)$ https://www.earnologist.com/$4
    <IfModule mod_deflate.c>
    	AddOutputFilterByType DEFLATE text/plain
    	AddOutputFilterByType DEFLATE text/html
    	AddOutputFilterByType DEFLATE text/xml
    	AddOutputFilterByType DEFLATE text/css
    	AddOutputFilterByType DEFLATE text/cache-manifest
    	AddOutputFilterByType DEFLATE text/javascript
    	AddOutputFilterByType DEFLATE text/vcard
    	AddOutputFilterByType DEFLATE text/vnd.rim.location.xloc
    	AddOutputFilterByType DEFLATE text/vtt
    	AddOutputFilterByType DEFLATE text/x-component
    	AddOutputFilterByType DEFLATE text/x-cross-domain-policy
    	AddOutputFilterByType DEFLATE application/xml
    	AddOutputFilterByType DEFLATE application/xhtml+xml
    	AddOutputFilterByType DEFLATE application/rss+xml
    	AddOutputFilterByType DEFLATE application/javascript
    	AddOutputFilterByType DEFLATE application/x-javascript
    	AddOutputFilterByType DEFLATE application/json
    	AddOutputFilterByType DEFLATE application/ld+json
    	AddOutputFilterByType DEFLATE application/atom+xml
    	AddOutputFilterByType DEFLATE application/manifest+json
    	AddOutputFilterByType DEFLATE application/rdf+xml
    	AddOutputFilterByType DEFLATE application/rss+xml
    	AddOutputFilterByType DEFLATE application/schema+json
    	AddOutputFilterByType DEFLATE application/vnd.geo+json
    	AddOutputFilterByType DEFLATE application/vnd.ms-fontobject
    	AddOutputFilterByType DEFLATE application/x-font-ttf
    	AddOutputFilterByType DEFLATE application/x-javascript
    	AddOutputFilterByType DEFLATE application/x-web-app-manifest+json
    	AddOutputFilterByType DEFLATE application/xhtml+xml
    	AddOutputFilterByType DEFLATE font/eot
    	AddOutputFilterByType DEFLATE font/opentype
    	AddOutputFilterByType DEFLATE image/bmp
    	AddOutputFilterByType DEFLATE image/svg+xml
    	AddOutputFilterByType DEFLATE image/vnd.microsoft.icon
    	AddOutputFilterByType DEFLATE image/x-icon
    </IfModule>
    <IfModule mod_expires.c>
    	ExpiresActive On
    	AddType application/x-font-woff2 .woff2
    	ExpiresByType application/x-font-woff2  "access plus 1 month"
    	ExpiresByType text/css A2419200
    	ExpiresByType text/x-component A2419200
    	ExpiresByType application/x-javascript A2419200
    	ExpiresByType application/javascript A2419200
    	ExpiresByType text/javascript A2419200
    	ExpiresByType text/x-js A2419200
    	ExpiresByType text/html A3600
    	ExpiresByType text/richtext A3600
    	ExpiresByType image/svg+xml A3600
    	ExpiresByType text/plain A3600
    	ExpiresByType text/xsd A3600
    	ExpiresByType text/xsl A3600
    	ExpiresByType text/xml A3600
    	ExpiresByType video/asf A2419200
    	ExpiresByType video/avi A2419200
    	ExpiresByType image/bmp A2419200
    	ExpiresByType application/java A2419200
    	ExpiresByType video/divx A2419200
    	ExpiresByType application/msword A2419200
    	ExpiresByType application/vnd.ms-fontobject A2419200
    	ExpiresByType application/x-msdownload A2419200
    	ExpiresByType image/gif A2419200
    	ExpiresByType application/x-gzip A2419200
    	ExpiresByType image/x-icon A2419200
    	ExpiresByType image/jpeg A2419200
    	ExpiresByType application/json A2419200
    	ExpiresByType application/vnd.ms-access A2419200
    	ExpiresByType audio/midi A2419200
    	ExpiresByType video/quicktime A2419200
    	ExpiresByType audio/mpeg A2419200
    	ExpiresByType video/mp4 A2419200
    	ExpiresByType video/mpeg A2419200
    	ExpiresByType application/vnd.ms-project A2419200
    	ExpiresByType application/x-font-otf A2419200
    	ExpiresByType application/vnd.ms-opentype A2419200
    	ExpiresByType application/vnd.oasis.opendocument.database A2419200
    	ExpiresByType application/vnd.oasis.opendocument.chart A2419200
    	ExpiresByType application/vnd.oasis.opendocument.formula A2419200
    	ExpiresByType application/vnd.oasis.opendocument.graphics A2419200
    	ExpiresByType application/vnd.oasis.opendocument.presentation A2419200
    	ExpiresByType application/vnd.oasis.opendocument.spreadsheet A2419200
    	ExpiresByType application/vnd.oasis.opendocument.text A2419200
    	ExpiresByType audio/ogg A2419200
    	ExpiresByType application/pdf A2419200
    	ExpiresByType image/png "access plus 1 year"
    	ExpiresByType application/vnd.ms-powerpoint A2419200
    	ExpiresByType audio/x-realaudio A2419200
    	ExpiresByType image/svg+xml A2419200
    	ExpiresByType application/x-shockwave-flash A2419200
    	ExpiresByType application/x-tar A2419200
    	ExpiresByType image/tiff A2419200
    	ExpiresByType application/x-font-ttf A2419200
    	ExpiresByType application/vnd.ms-opentype A2419200
    	ExpiresByType audio/wav A2419200
    	ExpiresByType audio/wma A2419200
    	ExpiresByType application/vnd.ms-write A2419200
    	ExpiresByType application/font-woff A2419200
    	ExpiresByType application/vnd.ms-excel A2419200
    	ExpiresByType application/zip A2419200
    </IfModule>
    <IfModule mod_rewrite.c>
    	RewriteEngine On
    	RewriteBase /
    	RewriteRule ^index\.php$ - [L]
    	RewriteCond %{REQUEST_FILENAME} !-f
    	RewriteCond %{REQUEST_FILENAME} !-d
    	RewriteRule . /index.php [L]
    </IfModule>
    AddHandler x-mapp-php5.5  .php
    
    #Begin Really Simple Security
    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{HTTPS} !=on [NC]
    RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/
    RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
    </IfModule>
    
    #End Really Simple Security
    # BEGIN WordPress
    # The directives (lines) between "BEGIN WordPress" and "END WordPress" are
    # dynamically generated, and should only be modified via WordPress filters.
    # Any changes to the directives between these markers will be overwritten.
    <IfModule mod_rewrite.c>
    RewriteEngine On
    RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
    RewriteBase /
    RewriteRule ^index\.php$ - [L]
    RewriteCond %{REQUEST_FILENAME} !-f
    RewriteCond %{REQUEST_FILENAME} !-d
    RewriteRule . /index.php [L]
    </IfModule>
    
    # END WordPress
    # Wordfence WAF
    <Files ".user.ini">
    	<IfModule mod_authz_core.c>
    		Require all denied
    	</IfModule>
    	<IfModule !mod_authz_core.c>
    		Order deny,allow
    		Deny from all
    	</IfModule>
    </Files>
    # END Wordfence WAF
    

    Thanks!

    Plugin Support jarnovos

    (@jarnovos)

    Hi @nealbo,

    I have a suspicion that the below RedirectMatch rule might be related to your issue, could you test the behavior without having that rule added?

    RedirectMatch 301 ^/([0-9]{4})/([0-9]{2})/([0-9]{2})/(?!page/)(.+)$ https://www.earnologist.com/$4

    Kind regards, Jarno

    Thread Starter nealbo

    (@nealbo)

    I’ve removed the line and cleared my caches but the issue remains. I believe that line simply redirects from my old URL structure (year/month/day etc.)

    Thread Starter nealbo

    (@nealbo)

    To make this even more unusual, I can see that the redirect works with no issue for uploads:

    https://www.earnologist.com/wp-content/uploads/2023/01/Star-Trek-Fleet-Command-Offerwall-Guide.jpg correctly redirects to https://www.earnologist.com/wp-content/uploads/2023/01/Star-Trek-Fleet-Command-Offerwall-Guide.jpg for example

    Thread Starter nealbo

    (@nealbo)

    I’ve resolved it, and it’s just as bizarre as the problem! I’d read that not having the https redirect high up enough in the .htaccess file can cause issues in wordpress – see https://webmasters.stackexchange.com/a/125746 and scroll down to “solution”. Curiously, the person having the issue also uses the same web host as me – Ionos (perhaps relevant?). Anyway, I grabbed:

    #Begin Really Simple Security
    <IfModule mod_rewrite.c>
    RewriteEngine on
    RewriteCond %{HTTPS} !=on [NC]
    RewriteCond %{REQUEST_URI} !^/\.well-known/acme-challenge/
    RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [R=301,L]
    </IfModule>
    
    #End Really Simple Security

    Which as you can see in my larger .htaccess dump above was quite low down and added it almost at the very top just underneath:

    #BEGIN Really Simple SSL LETS ENCRYPT
    RewriteRule ^.well-known/(.*)$ - [L]
    #END Really Simple SSL LETS ENCRYPT

    And that’s the problem resolved! In

    Plugin Support jarnovos

    (@jarnovos)

    Hi @nealbo,

    Interesting, glad to hear that you’ve managed to find the solution already.

    We greatly appreciate you sharing the solution here as well, it could definitely help other users experiencing similar behavior.

    I’ll mark the thread as resolved; but feel free to reach out if any further questions about the plugin arise.

    Kind regards, Jarno

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Strange Issue With Redirects (http->https) on non-homepage pages’ is closed to new replies.