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 ^(.*)$ https://mydomain.com/$1 [R=301,L]
And for some reason https://mydomain.com/sample-page/ is redirected to https://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?
- The topic ‘301 Redirect from HTTPS fails in strange way’ is closed to new replies.