Rewrites misbehaving... (1 post)

  1. mvandemar
    Posted 5 years ago #

    I have an installation where I am attempting to force non-ssl on all pages aside from wp-login.php, anything in wp-admin, and the contact form. The code I am using, which is above the WordPress rewrite, is as follows:

    RewriteEngine On
    RewriteCond %{HTTP_HOST} !^domain\.com$
    RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]

    RewriteCond %{SERVER_PORT} 443
    RewriteCond %{REQUEST_URI} !^\/wp-admin\/.*$
    RewriteCond %{REQUEST_URI} !^\/wp-login\.php$
    RewriteCond %{REQUEST_URI} !^\/contact-me-page\/$
    RewriteRule ^(.*)$ http://domain.com/$1 [R=301,L]

    The results are:
    Go to any page on the www version of the site, get redirected to non-www (expected).
    Go to https on wp-login.php or any wp-admin/ page, do not get redirected (expected).
    Go to https on any page aside from /contact-me-page/ get redirected to same page on non-https (expected).
    Go to https on /contact-me-page/ get redirected to index.php on non-https (unexpected).

    If I move the code below the WordPress rewrite block it gets ignored altogether. Anyone have any idea what might be going on here or how to fix it?



Topic Closed

This topic has been closed to new replies.

About this Topic


No tags yet.