I'm using the following rules on my WordPress website to:
- Redirect all http pages to https
Redirect the careers page to http
<IfModule mod_rewrite.c> RewriteEngine On # Go to https if not on careers RewriteCond %{SERVER_PORT} 80 RewriteCond %{REQUEST_URI} !^/careers$ [NC] RewriteRule ^(.*)$ https://www.mywebsite.com/$1 [R,L] # Go to http if you are on careers RewriteCond %{SERVER_PORT} !80 RewriteCond %{REQUEST_URI} ^/careers$ [NC] RewriteRule ^(.*)$ http://www.mywebsite.com/$1 [R,L] </IfModule>
The https
redirection works fine; however, the careers page does not redirect to http
. Any idea why?
here is what I have in wp-config.php
define('WP_HOME', 'https://' . $_SERVER['HTTP_HOST']);
define('WP_SITEURL', 'https://' . $_SERVER['HTTP_HOST']);
Try using
THE_REQUEST
instead ofREQUEST_URI
:THE_REQUEST
variable represents original request received by Apache from your browser and it doesn't get overwritten after execution of some rewrite rules. Example value of this variable isGET /index.php?id=123 HTTP/1.1
.Make sure these rules are placed above WP default rules.