Support » Fixing WordPress » 301 Redirect from HTTPS fails in strange way

  • I came across strange issue with 301 redirect. I have a need of redirecting all HTTPS traffic to HTTP except a few pages (let’s say it has URL /sample-page/). So I added a rewrite rule to .htaccess like this:

    RewriteCond %{SERVER_PORT} ^443$
    RewriteCond %{REQUEST_URI} !^\/sample-page
    RewriteRule ^(.*)$ http://mydomain.com/$1 [R=301,L]

    And for some reason https://mydomain.com/sample-page/ is redirected to http://mydomain.com/ – thought it has to be left as is. Every other HTTPS URL is redirected to its HTTP version as expected.

    I’ve tried this on clean WordPress installation with just permalinks turned on. This is true for every page, not just some specific.

    Also if WordPress rewrite rules are removed the redirect works fine. So it has to have something to do with WordPress. Does anyone know what it could be?

Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘301 Redirect from HTTPS fails in strange way’ is closed to new replies.