Home WordPress: Site is HTTPS; redirect only one site page over HTTP
Reply: 0

WordPress: Site is HTTPS; redirect only one site page over HTTP

user1511 Published in July 16, 2018, 2:44 am

I'm trying to get a website I'm administrating to redirect only one page over HTTP, while the rest of the site will be sent over HTTPS.

The server is an Ubuntu Server 16.04.3 setup, with WordPress 4.9 installed. The certificate is from Let's Encrypt.

According to another post I was reading, one of the solutions given was to add something similar to the following code in the site's .htaccess file:

# redirects non-www page requests to www version
RewriteCond %{HTTP_HOST} ^mywebsite\.com$ [NC]
RewriteRule (.*) http://www.mywebsite.com/$1 [R=301,L,NE]

# adds a trailing slash
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ /$1/ [R=301,L]

# 3 pages to be on https
RewriteCond %{HTTPS} off 
RewriteCond %{REQUEST_URI} ^/(order-form|employment-
application|about/contact-us)/ [NC]
RewriteRule ^(.*)$ https://%{HTTP_HOST}/$1 [L,R=301,NE]

# All other pages have to be on http
RewriteCond %{HTTPS} on 
RewriteCond %{REQUEST_URI} !^/(order-form|employment-
application|about/contact-us)/ [NC]
RewriteRule ^(.*)$ http://%{HTTP_HOST}/$1 [L,R=301,NE]

However, after applying this solution and restarting the apache server, the entire site went into a state of constant redirects and timeouts. As mentioned, I just need one page and one page only to be on HTTP, and the rest of the site can safely be on HTTPS. Any solutions would be greatly appreciated.

You need to login account before you can post.

About| Privacy statement| Terms of Service| Advertising| Contact us| Help| Sitemap|
Processed in 0.324164 second(s) , Gzip On .

© 2016 Powered by mzan.com design MATCHINFO